Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Spread across multiple file system I have numerous .webarchive files that were saved by OmniWeb. So for example:

sh-3.2$ ls -@ 2012-03-19.webarchive 
sh-3.2$ ls -@l 2012-03-19.webarchive 
-rw-r--r--@ 1 gjp22  staff  3722852 19 Mar  2012 2012-03-19.webarchive         26 
sh-3.2$ xattr -l 2012-03-19.webarchive 0000;4f66fcc8;;

Those files are treated as from an unidentified developer. I can open each one with a Control-click but it's tedious.

So I'd like a command, probably involving find(1), to remove all such extended attributes.

share|improve this question

1 Answer 1

up vote 13 down vote accepted
find . -iname '*.webarchive' -print0 | xargs -0 xattr -d
  • will remove (xattr -d) the extended attribute
  • from all files with an extension of .webarchive (-iname '*.webarchive')
  • located in the current directory and its subdirectories (. -depth, where the -depth is implied)
  • going through xargs (-print0 | xargs -0) to avoid problems with filenames containing spaces and other special characters (a similiar goal can be accomplished with slightly reduced efficiency by using find . -iname '*.webarchive' -exec xattr -d '{}' \;).

Explanation of the efficiency difference:

Whenever the syntax allows for it such as in this case, xargs assembles one or more command lines such as xattr -d /path/to/file1.webarchive /path/to/fileN.webarchive

while the in-my-opinion easier to remember find-only version repeats the command every time: xattr -d /path/to/file1.webarchive ; xattr -d /path/to/fileN.webarchive

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.