applescript "on adding folder items" problem


i am getting some strange behavior from my drobo fs. basically, i want to copy torrent files from my home network computers to the drobo fs. there my headless mac mini picks them up for processing.

copy from downloads folder to drobo fs working flawlessly using on adding folder items applescript. i also have created the following applescript on the mac mini to pick up the files :

on adding folder items to WatchedFolder after receiving DetectedItems
tell application “Finder”
move DetectedItems to folder “Turgon:Users:Scott:Downloads”
delete DetectedItems – not sure why this is necessary
end tell
end adding folder items to

for one things the move command never works. i must always delete files after move. why is that ?

the weird thing is the behavior of the mini. it seems to forget that the script is there. if i reboot, the script is not active. even stranger, sometimes, i have two identical mounts of the drobo volume on the mini.

i mount the drobo fs volume at startup with a simple script that run "mount volume “afp://user:password@ip.adress/volume”. i have also tried with a smb mount, but get same results.

does this ring any bells ? help !

  • scott

Not sure if this is the problem, but a couple things do come to mind.

The Finder may be copying rather than moving due to it crossing mount points. Typically the Mac (going back to classic Mac OS days) doesn’t like to perform moves across volumes for safety. For instance, if you were to drag the files in question from the DroboFS to your downloads folder, the Finder would default to copying.

Secondly, trying to use folder actions on a network drive is going to be dicey at best. Normally folder actions fire based on either fsevents (which only apply to local disks) or by watching a path, which may not have mounted yet when the folder action was loaded at login.

That said, I’d strongly recommend using Dropbox for something like this. It provides the same type of “cloud” between your computer and the Mini, but it does it all asynchronously - i.e., nothing has to be mounted at the same time for it to work, and due to the nature of Dropbox you’re not actually copying files about; just moving them. You’ll still need similar scripts to do the moving, but I’ll wager it would be a lot more reliable. Plus Dropbox is just damned useful in its own right. :slight_smile:

Perhaps the Applescript is trying to move the file while it’s still in use? Ie, still being copied?

I’d do a binary check the “copied but not moved” (or MD5/SHA1 checksum) on the two files - the original file that was not moved, and the copy in the new location to ensure they’re exactly the same.

If they are exactly the same, then it might be some kind of permissions issue.

I’m not a Mac guy and it’s been decades (really) since I Applescripted, so just providing general advice as I’ve encountered similar in Windows Script.