Identify the newest folder in a directory?

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

Moderator: Mr_Noodle

Identify the newest folder in a directory? Fri Dec 02, 2016 12:44 pm • by Flynntargart
Is there a way to identify the newest folder in a directory (for moving files into it - well, into a sub-folder of the newest folder). I guess one could use Applescript but that seems sloppy?
Thanks!
Flynntargart
 
Posts: 27
Joined: Mon Mar 29, 2010 12:07 pm

You can do "Date added is the 1 most recent" though that only works for the file/folder matching a rule, not the destination. Can you give a more concrete example of how you would use this?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Old post, I know. Just getting back to this topic is all.

Thanks for the reply!
The goal is to automatically file new incoming files in a dropbox folder "transfer".

The process is this:

1. Files appear in dropbox/transfer (audio files)
2. The Hazel rule covering "transfer" runs on those files:

If All:
Extension is aiff
Name Contains "Ep"
Date Added is This Week

Move:
to folder [Destination]

3. the folder [Destination] is the variable I'm seeking.

So the idea is that each week we do X recordings as required by the script. The filters make sure we only move the newly created audio files (unique to this weeks recording) and not the intro sound effects, scripts, etc. And it works exactly as needed.

The frustration is that each week I need to manually update [Destination].

Each week Hazel creates a folder, then another rule populates that folder with the shows template files, segment folders and the folder [Destination]. It's always named "RAW" (as in 'raw audio'). So each week I have to update [Destination] from "Dropbox/Episode 001/Raw" to "Dropbox/Episode 002/Raw" to "Dropbox/Episode 003/Raw" and so on each week.

If I could find a way to make [Destination] equal to the "Raw" subfolder most recently created, or the subfolder named "Raw" of the most recently created "Episode" folder, the rule would never require manual updates.

The goal being that, each week hazel creates the new episode folder (done), then populates that folder with the required folders and files for a new show (done), and then finally move new incoming files to that most recently created episode/raw folder. With that last step, our entire workflow becomes automatic. We can just press record directly into the transfer folder on the recording machine and then server will name and move everything. We just record and then edit. No more file management! So exciting ;)

Thoughts?
Flynntargart
 
Posts: 27
Joined: Mon Mar 29, 2010 12:07 pm

The only way I can see doing it is to make sure there is only one Episode folder there at a time. You can then use "Sort into subfolder" and use the "anything" token. So you could do "Episode (anything)" and that will match whatever Episode folder is there.

Again, though, it would have to be the only episode folder there so you'd need to rotate out the old ones, which may or may not be desirable.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support