microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.87k stars 6.59k forks source link

PowerRename: Option to restart counter for files inside different folders (independent counters for each folder) #28541

Open crisalis2 opened 1 year ago

crisalis2 commented 1 year ago

Description of the new feature / enhancement

I'd like that when I open PowerRename in a folder which in turn has many folders inside it, each of them with many files inside, and I use the ${} counter, PowerRename offers me an option to apply this counter independently for files inside different folders. Let's say I have the folder "Parent folder" and inside of it there are two folders, "Child folder 1" and "Child folder 2". Inside "Child folder 1" there are the files "File A.jpg" and "File B.jpg", and inside "Child folder 2" there are the files "Another file A.jpg" and "Another file B.jpg". Currently, if I open PowerRename in "Parent folder" and select that it matches the regex ".*" for files (without extension) only and replaces it with "${padding=3;start=0}", "File A.jpg" becomes "000.jpg", "File B" becomes "001.jpg", "Another file A.jpg" becomes "002.jpg" and "Another file B.jpg" becomes "003.jpg", but I'd like "Another file A.jpg" and "Another file B.jpg" to become "000.jpg" and "001.jpg" again, because they are inside a different folder.

Scenario when this would be used?

Imagine you have hundreds of folders with hundreds of files inside each one, and these files have slightly random names (but you are OK with their relative order, like for example their names are fileA01, fileA02, fileA03, then somehow there's no fileA04 but then there is fileA05, then fileA06, fileB01, etc) and you want all of them to just be 000, 001, 002 or something similar. If you use PowerRename for this, you would have to run it separately for each folder, hundreds of times... (If I'm not missing something).

Supporting information

No response

RaduMemetea commented 6 months ago

Hi, i just found a posible workaround until there is such a feature implemented. You can use the windows default behavior where you name 3 files the same name and windows automaticaly will add a counter starting from the second file (the counter also starts from 2 and it should follow this structure "\s(\n)" ). This method works like indended, for each folder there is an independent counter. And later you can rename the files again using whatever structure you want but this time integrate the number already present in the file name in the replace string.