Tip: Auto-Increment File Names

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Tip: Auto-Increment File Names Sat Mar 16, 2013 4:29 pm • by gcoghill
Thought I would share this blog post I wrote explaining how to auto-increment file names with Hazel. It's not all that advanced, but was something I'd not thought of until recently and thought it might be handy to bring to the attention of others.
gcoghill
 
Posts: 290
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Tip: Auto-Increment File Names Mon Mar 18, 2013 2:39 pm • by Mr_Noodle
Thanks for this. As far as always incrementing even if gaps occur, that was a choice I had to make. Maybe in the future I'll add an option to have Hazel always pick the lowest available number but that option can prove to be quite resource-hungry if the numbers get high as Hazel will have to check against every existing file every time.

Oh, and it seemed you double-posted the topic so I took the liberty of removing one of them.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tip: Auto-Increment File Names Mon Mar 18, 2013 2:46 pm • by gcoghill
I figured you had reasons for the behavior. 99% of the time for me it's not an issue anyways if I just stick with the process. I've not looked into it, but sometimes I need to name files -03a, -03b, etc. and not even sure that can be worked in.

No problem on the double post deletion, thanks!
gcoghill
 
Posts: 290
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Tip: Auto-Increment File Names Tue Mar 19, 2013 1:16 pm • by Mr_Noodle
I've also considered different numbering sequences like letters, though not sure how to deal with what happens after getting to 'z' (maybe do 'aa'). If this is something you might want, chime in as I'll file a feature request for it.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tip: Auto-Increment File Names Tue Mar 19, 2013 1:30 pm • by gcoghill
Honestly I think it's a niche case. Occasionally a client will ask for 2 variations for a round of revisions, and to remind me that it wasn't a major revision I'll append the "04a" and "04b" method to the file name. The next full revision would be "05" and so on. It seems too random (for my use at least) to ask Hazel to handle this. But if you did have a way to do so, I'd be interested. Thanks!
gcoghill
 
Posts: 290
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Tip: Auto-Increment File Names Mon Feb 17, 2014 11:32 am • by tillus
I have been using Hazel for three days now and I am absolutely flabbergasted at what it can do for me!

Maybe I am a niche user, too, but I have a similiar issue with auto incrementing. My use case is such: I want to number a file based on the highest file number living in the folder (which is usually also the last file edited). So the existing file structure would be:

TS01 individual file name.pdf
TS02 another file name.pdf
TS03 yet another file.pdf

I would like hazel to name the new file "TS04 new file name.pdf"

The reason I need it to look at the content is that I have multiple workflows that add files to this folder (some still manually) - so the logic of applying an increment each time hazel runs the rule does not apply here.

Am I missing something or is it not possible at the moment?
tillus
 
Posts: 3
Joined: Mon Feb 17, 2014 11:22 am

Re: Tip: Auto-Increment File Names Tue Feb 18, 2014 5:08 pm • by Mr_Noodle
This probably belongs in a separate thread since it really isn't covered by the original topic. You can use Hazel's # token to do the numbering for you. It will keep numbering until it finds a free number so it should do what you want. Just make sure to format it to use two digits (if you want to keep the leading zero). Search the help for more info on this.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS

cron