I have been actively tagging (with Finder Tags) most of my script files for some time to aid me in finding scripts of interest. I have to say that the Finder Spotlight Search using tags is working quite well.
But I have recently learned that when sending files to others the file does NOT retain the Finder Tags unless it is zipped, or “compressed” as it is called in the Finder. When I right-click on a file in the Finder and select “compress” for a file, it keeps the Tags. But when I run an AppleScript / Shell Script using the
zip command, the Tags are NOT retained. Here is my script:
tell application "Finder" set theItem to choose file --i had no problems when i changed this to choose folder set itemPath to quoted form of POSIX path of theItem set fileName to name of theItem set thefolder to container of theItem set zipFileHFS to (thefolder as text) & fileName & ".zip" set zipFile to quoted form of (POSIX path of zipFileHFS) set zipResults to do shell script "zip " & zipFile & " " & itemPath select zipFileHFS set itemList to selection set oZip to item 1 of itemList end tell
I also just tested this in Terminal, but still no Tags:
zip -X- zip_from_term_X.zip 'test File with Tags.txt'
What am I doing wrong?
Should I be using ASObjC? If so, how?
I need to zip/compress by script because after I zip the file, I need to do some other stuff with the zipped file using the script.
I have done considerable research and studied the zip command options, but to no avail.