14

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 
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
    com.apple.quarantine         26 
sh-3.2$ xattr -l 2012-03-19.webarchive 
com.apple.quarantine: 0000;4f66fcc8;OmniWeb.app;

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.

19
find . -iname '*.webarchive' -print0 | xargs -0 xattr -d com.apple.quarantine
  • will remove (xattr -d) the com.apple.quarantine 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 com.apple.quarantine /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 com.apple.quarantine /path/to/file1.webarchive ; xattr -d com.apple.quarantine /path/to/fileN.webarchive

  • 1
    find will do the same efficient filepath-assembling if you end it with \+ instead of \;. – Slipp D. Thompson May 1 '16 at 22:28
0

here is a more automated way to accomplish this:

open automator - select "service"

paste this

on run {input, parameters}
    tell application "Terminal"
        activate
        set filesString to ""
        repeat with file_ in input
            set filesString to filesString & " " & quoted form of (POSIX path of file_)
        end repeat
        do script "xattr -r -d com.apple.quarantine" & filesString
    end tell
    return input
end run

Make sure "files or folders" is selected for "Service receives selected". Make sure "Finder" is selected for "in"

then hit save and name it unquarantine, go to the folder or file you want to remove from quarantine and right click and select unquarantine

https://forums.macrumors.com/threads/%E2%80%9Cverifying%E2%80%9D-upon-opening-every-file.2065395/page-2#post-25134721

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .