Page 1 of 1

Renumbering folder names keeping the right sequence

PostPosted: Thu Dec 21, 2023 5:20 pm
by lch48a
Hi folks,

I have a folder with many subfolders with this patterned name: https://jmp.sh/wEhYVNfY
I would like to create a rule so that when a subfolder is deleted, the numbering sequence is reordered correctly, like so: https://jmp.sh/08afEHMG

I cannot seem to be able to do that. i've tried custom attributes, matching and everything else I could think of, but no luck.

Any help appreciated!

Re: Renumbering folder names keeping the right sequence

PostPosted: Fri Dec 22, 2023 10:34 am
by Mr_Noodle
I'm not sure if there's a way to do that with the built in conditions. It would need to compare dates against one another and do a bit more shuffling around. I think in this case, you will need a custom script of some sort.

Re: Renumbering folder names keeping the right sequence

PostPosted: Fri Dec 22, 2023 11:44 am
by lch48a
Thanks.
Alternatively I would like to have a txt filename that is constantly updated to reflect the total number of subfolders.
For example, from this: https://jmp.sh/acsuUzHt
To this: https://jmp.sh/yEsNQ97N
I tried using the item "number of elements" within the "other category" to rename the txt file but it does not return the correct value.

Re: Renumbering folder names keeping the right sequence

PostPosted: Tue Dec 26, 2023 9:32 am
by Mr_Noodle
Is the rule matching the folder or the file itself? Files do not have "Number of elements". You may need a nested condition with a target of the enclosing folder (check the manual for details).

Re: Renumbering folder names keeping the right sequence

PostPosted: Thu Dec 28, 2023 9:14 am
by lch48a
I tried various options but cannot figure out how to use the attribute "Number of items" correctly.

What i am trying to achieve is this: whenever a new folder X is added to folder A, folder X is renamed to "folder X (number or items in folder A)".

This is what I have: https://jmp.sh/dZ9ZQ3Wt
but "number of items" in this case means "number of items in folder X", not in folder A

Thanks for any help!

Re: Renumbering folder names keeping the right sequence

PostPosted: Thu Dec 28, 2023 11:00 am
by Mr_Noodle
Since the rule is matching folder X, then any attributes in that rule will apply to folder X. I think a script with specialized logic is needed there.

Re: Renumbering folder names keeping the right sequence

PostPosted: Thu Dec 28, 2023 4:12 pm
by lch48a
I chose different path. Now I am trying to have every folder within the monitored folder to reflect in its file name the number of items within the folder.

The rule I set up is this: https://jmp.sh/LD0luLLe

While the rule seems to work at times, I get erratic results:

- sometimes the rule gets stuck due to " ... is busy. Skipping for now."
- sometimes the folder gets renamed but the number inserted does not reflect the actual number of items, but a higher number (not due to hidden files)

Any advice on how I could make this work consistently?
Is there maybe a better condition than "Date last modifies is in the last 1 minute"? (However, I would need the rule to act in real time as soon as the modification occur).

Thanks!

Re: Renumbering folder names keeping the right sequence

PostPosted: Fri Dec 29, 2023 9:46 am
by Mr_Noodle
In general, "Date modified is after date last matched" is the best way to catch changes.

Maybe try "Sub-file/folder count" instead of "number of items" and see if that is any more reliable.

Re: Renumbering folder names keeping the right sequence

PostPosted: Fri Dec 29, 2023 11:03 am
by lch48a
Mr_Noodle wrote:In general, "Date modified is after date last matched" is the best way to catch changes.

thanks!
Mr_Noodle wrote: Maybe try "Sub-file/folder count" instead of "number of items" and see if that is any more reliable.

I can only find "Sub-file/folder count" in the conditions section of the rule, not the action section.
How can I use the "Sub-file/folder count" as an attribute in the rename action?

Re: Renumbering folder names keeping the right sequence

PostPosted: Tue Jan 02, 2024 10:41 am
by Mr_Noodle
Sorry, forgot that you were using it in a Rename pattern. It's not available there unfortunately. You might need to resort to some sort of script to get an accurate number if Number of Items isn't doing it.