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 " & folderPath & " '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 " & filePaths
Best Answer
You need to add:
To:
Example:
Another way to resolve this issue is to coerce the list
filePaths
to a string before it's used in thedo 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& space
as previously mentioned: