This is the script:
set d to do shell script "date +%d-%m-%Y" tell application "Finder" set dir to POSIX file ("/Volumes/Xsan/PathTo/Folder") as alias repeat with f in entire contents of dir if comment of f does not start with "Archived" then set comment of f to "Archived " & d set label index of f to 2 end if end repeat end tell
My problem is I am running this on a folder with 1000s of images and folders. Finder goes to around 90% CPU usage and it takes roughly 40 seconds PER FILE/FOLDER to set the comment and the label.
Is there some optimisation that anyone can suggest. Or alternatively, an alteration to the code that will allow a 100% Bash script implementation of this task? (If that helps with speed).
I feel there might be something in the "entire contents" command that is messing things up.
Like before it goes to make a change on a given file or folder, it is checking for tags of "Archived" on ALL of the files again after making a single change. I thought this would be cached in memory at the start.
Would love any ideas you may have!
edit: The system is Snow Leopard Server 10.6.8, Xserve2,1