Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nukiduz

macrumors 6502
Original poster
Apr 23, 2006
397
0
Hello there. I don't know almost anything about programming but I found Applescript very easy. I want to make a small script that copies a folder from my mac to a USB drive when it mounts. Something like a simple backup script. I don't know if this is possible but coul you help me with this? I'm not asking you to make it for me, in fact I prefer to do it myself. Thanks.
 
This is actually identical to my first applescript project. Great place to learn.

I have given you a little starter to help things along.


For this to work you will need to attach a folder action to your /Volumes folder.
So your script should look something like this

----------
on adding folder items to this_folder after receiving added_items

Your code here

end adding folder items to
----------
Where added_items is the variable that is assigned to the item that was added to that folder.

You may want to read the Finder dictionary to get the copying part done.

To do this open up script editor and File -> Open Dictionary and select finder.


To add the folder action you need to save the script, then in Finder Go -> Go To Folder -> /Volumes control- click and choose attach folder actions. (You may have to select enable folder actions first.)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.