System 10.6.8
I've been interested in certain folder actions for a long time, where dropping items in a folder would perform a service type operation.
I just had the need to zip a bunch of individual files, so thought it would be a perfect time to set up some folder actions to do this when the files are added to the folder.
Upon the start of the operation, I logged a "starting operation" and at the end, a "task complete", so I could monitor if this always worked from the console.
Well, it appears that it doesn't.
It appears that folder actions do not register that files have been added if the items being added are being copied from another server volume to the folder they are attached to.
Has anyone else seen this?
The same files work fine when placed into the folder with the folder action if they are copied or dragged form a local volume.
This is the script that I am using from MacScripter.net. It zips files that are dropped into the folder:
on adding folder items to FilestoZip after receiving droppedFiles
log ("Autozip: task started.")
repeat with aFiletoZip in droppedFiles
tell application "Finder" set theItem to aFiletoZip as alias set itemPath to quoted form of POSIX path of theItem set fileName to name of theItem if fileName does not end with "zip" then --this line fixed the problem set theFolder to POSIX path of (container of theItem as alias) set zipFile to quoted form of (theFolder & fileName & ".zip") do shell script "zip -r -j " & zipFile & " " & itemPath end if end tell log ("Autozip: " & fileName & " zipped.") end repeat
log ("Autozip: task complete.")
end adding folder items to
|