Renumbering folder names keeping the right sequence

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

Moderator: Mr_Noodle

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!
Last edited by lch48a on Fri Dec 22, 2023 11:28 am, edited 1 time in total.
lch48a
 
Posts: 5
Joined: Thu Dec 21, 2023 5:11 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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.
lch48a
 
Posts: 5
Joined: Thu Dec 21, 2023 5:11 pm

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).
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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!
lch48a
 
Posts: 5
Joined: Thu Dec 21, 2023 5:11 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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!
lch48a
 
Posts: 5
Joined: Thu Dec 21, 2023 5:11 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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?
lch48a
 
Posts: 5
Joined: Thu Dec 21, 2023 5:11 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support