Feedback needed: Sequential numbering

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Feedback needed: Sequential numbering Wed Nov 11, 2009 11:55 am • by Mr_Noodle
This has come up off and on before. This involves adding a way to insert a numerical sequence in your patterns so you can number files (file-001, file-002, etc.). While Hazel will automatically renumber files if there is a name clash, this will give you more control.

I'm bringing this up now because I'm considering including it in the next maintenance release. The chance is slim because it depends on a few significant details which may or may not line up with the timing. I haven't received much feedback on some key questions so I'm asking again here. If this is something you want, now is the time to speak up. Please answer the following, providing specific examples to back them up.

1. If you have files "file-1", "file-2" and "file-5" already in the folder (let's say "file-3" and "file-4" were moved or deleted), what is the next name that would be generated in the sequence? "file-3"? "file-6"? Something else?

2. Using the same example as #1, suppose there was a "file-6" and "file-7" but they got deleted or moved to another folder. Is the next name in the sequence "file-6" or "file-8"? Something else?

3. Would you want the sequence to be reset? If so, when and how?

I may have more questions based on the answers to these. I look forward to your responses.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Wed Nov 11, 2009 7:53 pm • by sjk
Mr_Noodle wrote:While Hazel will automatically rename/renumber files if there is a name clash, this will give you more control.

My answers will be mostly applicable to that name clash renumbering.

1. If you have files "file-1", "file-2" and "file-5" already in the folder (let's say "file-3" and "file-4" were moved or deleted), what is the next name that would be generated in the sequence? "file-3"? "file-6"? Something else?

In most cases I wouldn't want file-3 (and file-4) to be reused as long as file-5 (and beyond) still exists. I normally prefer auto-numbered filenames to be sequenced in a way that's also forward-time sequential.

2. Using the same example as #1, suppose there was a "file-6" and "file-7" but they got deleted or moved to another folder. Is the next name in the sequence "file-6" or "file-8"? Something else?

In that case reusing file-6 would usually be acceptable.

3. Would you want the sequence to be reset? If so, when and how?

Not sure; I'll have to think about it more.

Here's a specific example of name clash renaming issue I'd like more control over (on Leopard):

I've got a simple rule that moves "Picture #" screencapture files (generated with default OS X keyboard shortcuts) from Desktop to another folder. As long as only one screencapture exists on Desktop at a time (named "Picture 1") Hazel's renaming will proceed from "Picture 1" to "Picture 1-1", "Picture 1-2". etc. in the destination folder. And if more than one exists on Desktop (named "Picture 1", "Picture 2", etc.) the renaming also starts including "Picture 2", "Picture 2-1", etc. That's logically consistent because Hazel is simply adding a "-#" suffix when necessary. However, it can soon throw off the forward-time sequencing associated with the filenames, e.g. "Picture 2" will have been created before "Picture 1-6", so I can no longer rely solely on the numbering to indicate which files were created before/after others.

I've now changed that to use a more Snow Leopard-like pattern of "Screen shot <date>.<extension>", omitting "at <time>" because there's no built-in pattern for time (yet; consider this an informal request for it).

That shows one way Hazel's current automatic sequential numbering could be confusing, even if provoked by the original files being created with a numeric suffix. For this it's preferable to work around it by avoiding numeric sequencing altogether but there may be other instances where pattern-related changes you make for it could be useful.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Feedback needed: Sequential numbering Thu Nov 12, 2009 11:39 am • by Mr_Noodle
sjk wrote:In most cases I wouldn't want file-3 (and file-4) to be reused as long as file-5 (and beyond) still exists. I normally prefer auto-numbered filenames to be sequenced in a way that's also forward-time sequential.


Fair enough.

sjk wrote:In that case reusing file-6 would usually be acceptable.


But would using "file-8" be acceptable as well?

sjk wrote:
3. Would you want the sequence to be reset? If so, when and how?

Not sure; I'll have to think about it more.

This point is a sticky one and will probably determine whether I can do this feature for this release. No one has given me a clear picture on when this would happen so I'm not even sure how to attack the problem.

As for your example, if you specified a renaming pattern like "Picture-(#)" where (#) is an attribute representing the counter, it wouldn't add the "-1" or whatever at the end but instead increment the counter until a unique filename was found. Hazel can't really do this automatically for arbitrary file names as it could end up incrementing numbers that it shouldn't be. For instance, if you download an app like "SomeApp 2", you are expecting Hazel to somehow know that the "2" is a part of a version number and shouldn't increment it to, say, "SomeApp 3", giving the user a false sense of a brand new version.

sjk wrote: because there's no built-in pattern for time (yet; consider this an informal request for it).


Have you tried editing the date formatting? Click on the token and select "Edit Date Pattern". From there, you can drag in time elements.

Many thanks for feedback. Hopefully more of you that have clamored for this feature in the past will chime in as well.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Thu Nov 12, 2009 11:48 am • by Mr_Noodle
Another question:

Right now, the special "counter/sequence" attribute would only be available for the rename action, not the sort into subfolders one. Do you want to be able to generate subfolders with a new sequence number each time? Here, a concrete example would definitely be needed as I can't really come up with a real world case for this.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Thu Nov 12, 2009 7:27 pm • by sjk
Mr_Noodle wrote:Have you tried editing the date formatting? Click on the token and select "Edit Date Pattern". From there, you can drag in time elements.

That worked -- thanks! My now Snow Leopard compatible Rename file pattern looks like:

Screen shot (date created)(extension)

… with at (hh).(mm).(mm) time elements appended to the (date added) token. And that doesn't modify the default value of the token, only the copy in the pattern. Neat. :)

Btw, I first tried using : between time elements and they acted like right-arrow. Then I switched to / and they were echoed as :, but actually became / in the pattern when I checked later. And entering / again later echoed /. Not sure why there was a temporary / to : translation during the first input.

More followup to the rest of your reply when I've more time later.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Feedback needed: Sequential numbering Thu Nov 12, 2009 8:51 pm • by sjk
Mr_Noodle wrote:But would using "file-8" be acceptable as well?

Sure, if the previously deleted/moved file-6 and file-7 remained unused in that sequence. I wouldn't care if there are gaps. In fact, that might be preferable as an indicator of which files were removed from the sequence.

It bothers me how File > Duplicate in Finder reuses deleted *copy* filenames when there are still higher numbered ones in a sequence, i.e. filling in any gaps. My typical usage would be to delete a few earlier ones while retaining later ones, then use Duplicate again later to save a current copy after the last previous one. Unfortunately it doesn't work like that.

Which kind of leads into this …

As for your example, if you specified a renaming pattern like "Picture-(#)" where (#) is an attribute representing the counter, it wouldn't add the "-1" or whatever at the end but instead increment the counter until a unique filename was found.

It would be handy if a Hazel renaming pattern could be used to sequentially rename a selection of *copy* files and fill in any missing gaps to force Finder's Duplicate of the original to use the next available name after the last one. A special case might be when "file copy.ext" has been removed, awaiting replacement with the first available "copy #.ext" of the remaining sequence.

Hazel can't really do this automatically for arbitrary file names as it could end up incrementing numbers that it shouldn't be. For instance, if you download an app like "SomeApp 2", you are expecting Hazel to somehow know that the "2" is a part of a version number and shouldn't increment it to, say, "SomeApp 3", giving the user a false sense of a brand new version.

Understood. I don't think that needs to nullify the possibility of renaming "arbitrary" *copy* files as long as the context is properly controlled. Or maybe I'm stretching this pattern renaming where it won't fit.

Many thanks for feedback. Hopefully more of you that have clamored for this feature in the past will chime in as well.

I'm not one of those clamorers but the idea is inspiring and hopefully my feedback is making sense. :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Feedback needed: Sequential numbering Thu Nov 12, 2009 9:03 pm • by sjk
Mr_Noodle wrote:Right now, the special "counter/sequence" attribute would only be available for the rename action, not the sort into subfolders one.

Being limited to the rename action would probably be sufficient for any purpose I might find for it, at least for awhile, since I haven't even explored Sort file into subfolder usage yet.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 11:16 am • by Mr_Noodle
Thanks again for the response.

Having the counter always increment regardless of any gaps right now seems to be the most predictable to me. If you did reset the sequence, it would end up filling in gaps as it works it way back up but the question still remains if/when/how the sequence would be reset. Again, examples of this would be immensely helpful.

I have the code working now but the only way to reset a sequence for a folder is to run a command on the commandline. I don't know if this is acceptable. Any sort of UI for this would take more design/work than I can fit in this release (I'm hoping to go beta early next week).

Lacking any more responses, I may have to put this feature on ice until 3.0.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 3:02 pm • by noddy67
I would definitely welcome the renumbering facility for duplicate files.
noddy67
 
Posts: 4
Joined: Wed Oct 28, 2009 4:41 am

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 4:09 pm • by Mr_Noodle
Thanks for the vote but I ask that you answer the questions I posed above. The issue has nothing to do with whether people want it. The problem is that no one has stepped up to describe how they will use it and without that I can't design it out properly. The window of time for this to be included in the next release is closing so if you actually care about having this included, please address the points I originally posed otherwise it goes on the backburner for some other release.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 4:30 pm • by noddy67
Ok well I'm a newbie to this stuff so please bear that in mind but intuitively I would think it makes more sense to just keep the sequence going irrespective of gaps/deleted files etc. At least that way the chance of a file name being duplicated would be much less, and from a programming perspective you could in subsequent releases add a pop up facility that asks the user the question in the event that there were gaps in the sequence.
That way the basic functionality is in place while still leaving the possibility of further refining/enhancing it later on.
noddy67
 
Posts: 4
Joined: Wed Oct 28, 2009 4:41 am

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 4:59 pm • by Mr_Noodle
Don't worry about being a "newbie". The whole point of this is I want to know how users actually expect this to work out in the real world. Thanks for the input on ignoring the gaps. That actually is how I have it implemented now since, as I said, it's more predictable.

Nonetheless, the question remains as to how, if and when the sequence would be reset. Do you care if the sequence keeps increasing until infinity? If you just keep the files there then maybe that's ok. But maybe you want to do some thing where you move the files out of that folder at some point and expect the sequence to start at 1 again? If so, how would you expect Hazel to know that? Or maybe having an empty folder does it automatically?

I'd like most of this figured out up front as if I do it incorrectly now, it may be hard to change it later since people will by then already be reliant on the old way. While I may be able to get away with implementing just some parts, it'd be better for the long term if I at least know where this feature is going.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 5:15 pm • by Mr_Noodle
I will say that I might be willing to just implement the sequencing without any interface for resetting it if you don't really need to reset. As I mentioned before, the way I have it now, you can run a command in Terminal to do it. If sequence resetting is something no one would really use or only use rarely, then I'd be ok with having it be that way until something better can be done later on down the line.

Thoughts?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 5:23 pm • by noddy67
I think that makes sense. Certainly the resetting aspect would be a very low priority for me and presumably in the mean time the resetting could be accomplished in a round about way via a moving the files into a new folder type solution.
noddy67
 
Posts: 4
Joined: Wed Oct 28, 2009 4:41 am

Re: Feedback needed: Sequential numbering Fri Nov 13, 2009 6:52 pm • by sjk
Mr_Noodle wrote:Nonetheless, the question remains as to how, if and when the sequence would be reset. Do you care if the sequence keeps increasing until infinity? If you just keep the files there then maybe that's ok. But maybe you want to do some thing where you move the files out of that folder at some point and expect the sequence to start at 1 again? If so, how would you expect Hazel to know that? Or maybe having an empty folder does it automatically?

If (from one of you earlier posts):

you specified a renaming pattern like "Picture-(#)" where (#) is an attribute representing the counter

… would it make sense to do automatic counter reseting whenever no previous instances of Picture-(#) are matched? Triggering it with an empty folder seems to assume there won't be any other files of interest there, which I could foresee usually being unlikely for my usage.

Going back to my Finder Duplicate example, deleting all *copy* files implies reseting the counter, i.e. the next Duplicate will start over with *copy.ext. There's no dependency on other files in the folder. I'm thinking Hazel's counter resetting could work similarly.

I will say that I might be willing to just implement the sequencing without any interface for resetting it if you don't really need to reset. As I mentioned before, the way I have it now, you can run a command in Terminal to do it.

That would be fine, though would it make since to also do auto-resetting?

I'm also not quite clear what effect counter resetting has when files matching a renaming pattern still exist. Will there be a fill-in-the-gap behavior?

Too bad people who've requested this feature aren't around now for the discussion to possibly bring up issues we're overlooking.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Next

Return to Open Discussion