Batch Removal of "Where from" Metadata Without a Handler I have many images that contain the "Where from" metadata in the "get info" section that shows the URL where they were downloaded from. I want to remove this information from all of them at the same time.

I created an Applescript that works when the shell script retrieves one image from the selected folder in finder. But when the shell script result is multiple images, I get the following error:


  xattr: No such file:


I need the Applescript to work without the use of a handler since it will be used in an application that does not accept handlers.

tell application "Finder" to set selectedFolder to selection as alias list
set folderPath to quoted form of POSIX path of selectedFolder

set getImages to "mdfind -onlyin " &amp; folderPath &amp; " 'kMDItemKind = *image'"
set selectedImages to paragraphs of (do shell script getImages)

set filePaths to {}
repeat with thisFile in selectedImages
    set end of filePaths to quoted form of POSIX path of thisFile
end repeat

do shell script "xattr -d com.apple.metadata:kMDItemWhereFroms " &amp; filePaths
You need to add:

&amp; space


To:

set end of filePaths to quoted form of POSIX path of thisFile


Example:

set end of filePaths to quoted form of POSIX path of thisFile &amp; space




Another way to resolve this issue is to coerce the list filePaths to a string before it's used in the do shell script command, as after all it does get coerced in the process.

So, just before the do shell script "xattr ... command, do the following, instead of using &amp; space as previously mentioned:

set text item delimiters to space
set filePaths to filePaths as string
set text item delimiters to ""