mount drive, move files, unmount drive workflow

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

mount drive, move files, unmount drive workflow Sun Nov 15, 2015 12:39 pm • by mnisbet
Hello,

Hoping someone better versed in Hazel than myself can help.

I'm looking to accomplish the following:

Monitor folder for files of type document.
If match detected mount drive, move all matched files into drive, then unmount.

The problem I'm encountering is the drive is ejected after each file is moved, so I have to re-enter the drives password for every file. I don't want to store the password for the drive in keychain.

Any tips how I could mount the drive move all matched files, and only then unmount the drive?

Best wishes.
mnisbet
 
Posts: 2
Joined: Sun Nov 15, 2015 11:53 am

Note that Hazel doesn't know anything about batches. From its POV, it just sees a stream of files coming in so it can't know when it's done. One way to do something like this is to have Hazel match a folder and move that instead of the individual files though again, Hazel by itself can't know when that folder is "ready" to be moved. You'll have to figure out some system like adding color labels to do that.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for replying. I've put together a workflow that seems to do what I want. It involves monitoring two different folders.

I monitor the downloads folder (or any folder where files are) for kind = document.
If a match is found I mount the drive via applescript (I'm prompted to enter password to allow this)

I also monitor the folder /Volumes for the name of my mounted disk image (this is found in the root of your hard drive, this folder is hidden by default so you'll need to display hidden files/folders in the file/folder selector dialog box). I also added a condition that the drive has not been modified in the last 5 minutes (so as not to interrupt the movement of any files that were triggered above)
If a match is found I then run a script to unmount the drive.
mnisbet
 
Posts: 2
Joined: Sun Nov 15, 2015 11:53 am


Return to Support