Question on automatic renaming

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

Question on automatic renaming Sat Aug 02, 2008 1:12 am • by VBGeek2000
Hi,

Is there a way to specify where the character goes when renaming a file to prevent duplicates? Here is my situation.

1. Automated process downloads file from web site to downloads folder.
2. Hazel grabs it and moves it to the correct folder, renaming it with the domain - name.extension

That works great unless there is a duplicate. Duplicates show up like this:
http://www.site.com - 1011.pdf
www-1.site.com - 1011.pdf <-- duplicate downloaded later

I don't want to add the date to the file name to make them unique. In a perfect world, I could specify where to add the "-1" to make it unique, such as after the name tag. So the files would show up like this:

http://www.site.com - 1011.pdf
http://www.site.com - 1011-1.pdf

Is this possible, or does Hazel add the -1 before the first period in the file name?

Thanks,
Tim
VBGeek2000
 
Posts: 4
Joined: Sat Aug 02, 2008 1:05 am

Re: Question on automatic renaming Mon Aug 04, 2008 2:33 pm • by Mr_Noodle
Hazel sticks the number after the first dot. It was done that way to emulate how Safari does it. I thought about doing it after the last dot but then you have those odd edge cases where there are two extensions, like .tar.gz. I'll think about switching it over to the last dot since the .tar.gz case is relatively uncommon or maybe have some special case for .tar.gz (and other combinations) files.

I've also thought about adding a token to drop into patterns that could be used for sequential naming. There are issues such as:
  • If you have "file-1", "file-2" and "file-4", is the next one "file-3" (to fill in the gap) or "file-5" (to use the next number in the sequence)?
  • Do people want to reset the sequence and if so, where does the interface for that go?
  • Does the sequence only pertain to the specific folder it's in or to the rule as a whole. There are odd cases when you move things into a subfolder, do they share the sequence of the whole rule or since they are in different folders, do they get a new sequence.

If anyone has any examples of where you might use this, post here as it would be helpful for me in designing the feature (if I end up doing it).
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Question on automatic renaming Mon Aug 04, 2008 10:37 pm • by VBGeek2000
Thanks for responding. I would be perfectly happy with a token to specify where to add the sequential id should go in the file name.

Adding the token would allow users to specify the location if those choose. Otherwise, the renaming operates like standard OSX renaming.

I forgot about the occasional "double extension" files.

Thanks again for the response!
Tim
VBGeek2000
 
Posts: 4
Joined: Sat Aug 02, 2008 1:05 am

Re: Question on automatic renaming Wed Aug 06, 2008 2:14 pm • by Mr_Noodle
I think in the short term, I'll make the built-in renumbering a tad smarter but the sequential token, as I outlined above, will require more thought so it might be a while before I get that in. Again, letting me know how you'd want it to work or posting more use cases will help me to design it out.

Thanks.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Question on automatic renaming Thu Aug 07, 2008 3:31 pm • by Mr_Noodle
Just thought I'd let you know that I've come up with a much smarter algorithm for determining the file extension. It should handle cases like .tar.gz but also ignore other things after dots that aren't actually extensions. This will also affect what part of the filename is considered the "name" and what part is the "extension" in rules and such but it should be for the better.

The new algorithm should be in the 2.2.2 patch. I'm thinking of doing a public beta of this sometime next week as there are some other changes/fixes I'd like tested but if it's more urgent, drop me an email and I can send you a test build hopefully by the end of the week.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Question on automatic renaming Thu Aug 07, 2008 10:50 pm • by VBGeek2000
Thanks for the update on the status. I'll be happy to wait until the beta program is ready. I'll keep watching for the beta version.

Thanks again for the update and your hard work,
Tim
VBGeek2000
 
Posts: 4
Joined: Sat Aug 02, 2008 1:05 am

Re: Question on automatic renaming Fri Aug 15, 2008 12:58 pm • by Mr_Noodle
Just a note that I've put the beta up. Check the beta forum.

I've made the renumbering much much smarter. It should be able to tell between what dots are used for the file extension and what parts just happen to be separated by dots (like domain names, version numbers, etc). It should stick the numbers where you'd expect. Give it a spin and let me know if it works out for you.

Thanks.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Question on automatic renaming Sat Aug 16, 2008 2:02 am • by VBGeek2000
Hey,

I tried out the beta and it is working perfectly. Thanks for your prompt and complete fix to my situation!

Tim
VBGeek2000
 
Posts: 4
Joined: Sat Aug 02, 2008 1:05 am


Return to Tips & Tricks - DO NOT POST QUESTIONS