Merge folders

Advanced Renamer forum
#1 : 17/03-22 01:43
Henry Cabrera
Posts: 9
When renaming several folders, some of them end up with the same name. AR let's me know and says it can't do it. Is there a way to force it? Maybe recognize the folders with the same name and merge them into one?
Ex: folder 1; folder 2;
Renaming into just"folder"
#2 : 18/03-22 13:39
David Lee
Posts: 1125
It is not possible to merge folders when renaming. However a workaround is to move files to a new folder. Non-existent folders will be created but original folders will not be removed if empty and will need to be deleted manually.

Whilst files can be moved using Batch mode: "Move" it is more flexible to use Batch mode: "Rename" and then use a Script method to reset item.newPath.

Hint: If you want to write your new folders to the same parent directory as the existing folders then you can obtain the path of the parent directory using the code:

item.path.match(/^.*\\(?!$)/)[0];

so if the new folder name is saved in the string newFolder....

item.newPath = item.path.match(/^.*\\(?!$)/)[0] + newFolder;

There is no need for a return statement unless you wish to rename the files at the same time.

edited: 18/03-22 14:27
#3 : 19/03-22 15:37
Henry Cabrera
Posts: 9
Reply to #2:
Thanks, I found a way with your advice
#4 : 19/03-22 17:05
Henry Cabrera
Posts: 9
Reply to #2:
Well I mess up XD
I am trying to do it with 'Move' and it was working just fine.
I used Move into folder with <name> but some folders have digits, and I don't want that. I only want the folder with all the words in the file name. Is that possible?
Ex: video taping 20220319.mp4
Into folder
Video taping