run process of contents of folder after ~5 minutes

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

Moderator: Mr_Noodle

Assume there is a folder such as ~/Dropbox/Audio/Podcast Pile/ into which new files¹ will occasionally appear.

(¹ not folders, just files… actually, they will always be mp3s, if that helps)

In the main folder are sub-folders. Mostly we want to ignore those folders and just focus on the files.

Now, imagine that sometime during a given day, 3 different computers each start to upload a different file to the main folder. The files are large enough that it may take a minute or two to upload them. The files will be uniquely named so there's no worry about that.

However, given "Internet weather" it's impossible to know which one will be first, second, or third. But I need to make sure I have all 3 before I start.

Also, I used "3" as an example, but there could be 1 or 2 files, or there could be 5 files. So I can't just wait until I have a certain number of files.

I can (fairly safely) assume that each file will arrive within a few minutes of each other.

The Hazel rules will be comparing each of those files to one another, so I want to make sure that all of the files have arrived before I take action on them.

I was thinking that the easiest way to do this might be to say "Wait until no file in the folder (not sub-folders just the main folder) has changed or no new files have been added for at least 'X' minutes." (Let's say '2 minutes' for the sake of discussion, but I might make it as high as 5 minutes.)

I'm sure this must be possible, but I'm not wrapping my head around it enough to figure it out.
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

You can try having a rule match the folder containing those files to see if date modified on the folder has changed. The folder's date modified usually only gets updated when items are added or removed. To do that, though, you'll have to monitor the folder containing that folder.

Otherwise, you'll have to do some sort of thing with nested conditions which can get very messy since you don't know how many other files there are supposed to be.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support