I've downloaded the following apple script, which moves airdropped files to a specified folder (which I'll refer to as the Airdrop folder):
property AIRDROP_FOLDER : "Macintosh HD:Users:pschorn:Airdrop"
property QUARANTINE_KEY : "59"
property GET_QUARANTINE_COMMAND_START : "ls -l -@ '"
property GET_QUARANTINE_COMMAND_END : "' | tr '\\n' ' ' | sed 's/.*com\\.apple\\.quarantine\\s*\\(\\d*\\)/ \\1/' | awk '{$1=$1};1'"
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to length of added_items
set current_item to item i of added_items
set quarantine_type to getQuarantineType(POSIX path of current_item)
if quarantine_type is equal to QUARANTINE_KEY then
moveFile(current_item, alias AIRDROP_FOLDER)
end if
end repeat
end adding folder items to
on moveFile(move_file, destination_dir)
tell application "Finder"
move move_file to destination_dir with replacing
end tell
end moveFile
on getQuarantineType(file_path)
return do shell script GET_QUARANTINE_COMMAND_START & file_path & GET_QUARANTINE_COMMAND_END
end getQuarantineType
I followed the instructions on this website to set it up as a folder actions script.
However, if I move an airdropped file out of my newly created airdrop folder and back into my downloads folder, it gets automatically put BACK in the airdrop folder. I don't want this to happen.
I found that after applying this terminal command xattr -d com.apple.quarantine [file path of airdropped file]
, the file will no longer get moved back into my airdrop folder after I move it out.
MY question is: How do I integrate this command into the above apple script so that the airdropped files do not automatically get moved back to my airdrop folder after I move them out of it?