MUSIC/ZZ TOP
with subfolders that all start with ZZ TOP
C:\MUSIC\ZZ TOP\ZZ TOP - GREATEST HITS
Want to rename the sub folders into: C:\MUSIC\ZZ TOP\GREATEST HITS
In other words, remove the (ZZ TOP - ) from the beginning of all subfolders, leaving just the album name.
I hope this can be done as I have a music collection with over 400 thousand folders, many named as above creating long file names at the file level.
So remove the initial part of a subfolder name if that matches the parent folder.
This can be done with the following javascript function:
- Code: Select all
var path = object('folder');
var subfolders = path.split("\\");
var lastsub = (subfolders.length > 1) ? subfolders[subfolders.length - 2] : "";
newName = name.replace(lastsub, "");
newName = newName.replace(" - ", "");
Use Filter (12) to only select to view Folders and activate Subfolders.
Then select all and apply above function.