Batch Folder renaming with filtering

Advanced Renamer forum
#1 : 17/12-20 18:25
Nico
Posts: 2
Hi folks,
i would like to batch rename all folders (adding 48k in their name) containing files with specific caracters (48k). Is that possible with advanced renamer ?

In the "Rename Files" tab, i found a way to filter files according to their name, but if i want to rename folders, i have to import them via the "Rename Folders" tab, right ? I didn't find any option there to filter the folder according to the name of the files in them.

Is there a way around it ?

Thanks

Nico
#2 : 18/12-20 14:54
David Lee
Posts: 1125
I don't think that this is possible directly.

However you can load all your files containing "48k" and use the "Move Files" Batch Mode to move them into corresponding new folders.

Empty folders will not be removed but you can use a script to move them into a new temporary folder that you can delete using Windows Explorer.

1) Move the "48k" files...
Make sure no renaming Batch Methods are selected.
Select Batch mode: Move
In the Output folder box: navigate to the root folder containing all your subfolders and append "<DirName:1>48k"
ie C:\path...\root folder\ <DirName:1>48k

Drag the root folder into the List
In the "Add folder " dialogue...
Select "Add the files in the folders" and "Include subfolders"
Filename mask: *48k*

Click OK and Run the Batch

2) Move the empty folders...
Drag the root folder into the List again
Select "Add the folders" and "Add subfolders"

Create a Script method and enter the code:

if (item.filesInDir == 0) {
item.newPath = item.path + "EmptyFolders";
} else {
item.newPath = item.path;
}

Run the Batch and delete the "EmptyFolders" folder manually.





edited: 18/12-20 14:55
#3 : 20/12-20 12:46
Nico
Posts: 2
Hi David,
thanks for your reply.
I finally found a way, loading all the files, then generating a file list, which i loaded in the "Rename folders" tab.

edited: 20/12-20 12:47