2012-03-28

ibneko: (Default)
2012-03-28 04:31 pm
Entry tags:

Removing xattr from files in a directory

Here's a one-liner to remove xattr from files in a directory on MacOS X. (Mostly to quickly strip out the annoying quarantine flag set on downloaded files).

for i in $(ls -Rl@ | grep '^ ' | awk '{print $1}' | sort -u); do echo Removing $i ... >&2; find . | xargs xattr -d $i 2>/dev/null ; done

Note the space after the ^ should be typed with control-v, then tab (to insert a proper tab).

Found this over at http://zzamboni.org/brt/2008/05/07/removing-all-extended-attributes-from-a-directory-tree/index.html. Posting it here so I don't lose the stupid thing again.