Auto-Detect Mounted Volumes

Helping set up for the AUPN launch party this weekend, I needed to load files onto 100 USB flash drives for the obligatory swag bag. To churn through it efficiently, we had an Automator workflow copy the files onto the drives. All I had to do was insert a drive, double-click the workflow app, wait until it copied the files and unmounted the drive, then unplug the drive.

After doing this a few times, it seemed silly having to manually run the workflow; I wanted it to run automatically when a drive was plugged in. Fortunately, the solution came to me in a flash (pun absolutely intended).

It occurred to me that a folder action should detect not only files, but also devices. When you mount a drive, what folder does it appear in? Your instinct may say “the Desktop,” but this is a Finder illusion. In fact, mounted drives appear in the invisible root-level directory /Volumes/.

Thus, I saved the workflow as a folder action plug-in for /Volumes/, and it worked perfectly. All I had to do was insert a flash drive, wait for the workflow to finish, remove the drive, and insert another one â€“ 100 times.

Here are the steps:

Go to File > Save As Plug-in.

Choose Folder Action from the pop-up menu.

In the Attach to Folder pop-up, select Other…

In the resultant open dialog, hit cmnd-shift-g. This will bring up a small sheet labeled Go to the folder:.

In this sheet, type /Volumes/, and hit the Go button, then hit Open.

Hit the Save button in the Plug-in sheet.

With this trick, any mounted device will trigger the attached workflow. What that workflow does is up to you, but the possibilities are endless.

Comments

Hello. We are working on an application that we want to copy a finished file to a USB storage device like your app, but I would like to mount the USB device first before an event and then when the event is finished automatically copy the file without having to remember to stick the drive in everytime. Is this possible? The whole Automator script would be ical triggered.

now i want to make one automator …
i use many pendrive for data transfer & use.
i want instatant copy automatore which he copy all my pendrive data in my document in one folder..
i need urgent please give hints or move clipe to how to do this type of automatore.