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
list
containing a single string and, where necessary, knowing when to use thestring
rather than thelist
, it isn't able to do this with any list of two or more items. NeitherPOSIX path
norquoted form
are properties available to alist
so both are going to complain if you make them try and deal with anything besides the trivial case.