GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Renaming Directories after File Names

Hi Team,
I have just moved my video collection onto a NAS and the Media Server I have installed on it has a prefered way of having the files named. All good and dandy. What I would like to do, is rename all the directories so they are identical to the largest file that is contained within each directory.
I found an earlier post which contained -

Rename FROM {filepath|noterm|..} TO {file|noext}

which I placed in a button and works perfectly, trouble is, I have become tired of doing this after 60 directories. I have 1600 directories to go. Any help on being able to put this into a loop that goes through each directory and renames them is greatly appreciated.

Stu.

Do you want to only rename selected directories (e.g. go to a certain folder, select-all, then click a button to rename those directories, but not directories inside them)? Or do you want to rename directories recursively?

For each directory, do you want its name to be the same as the largest file directly below the directory, or anywhere below it, including sub-folders?

I'm assuming you want the extension taken off the end of the file (like in the example command), but if not let me know, or any other requirements.

Hi Leo,
I was thinking somethin along the following lines:

Movies
Good Movie 1080p DVD Subs
Good Movie (1999).mp4
Good Movie (1999) eng.srt
Better Movie 720p noSubs {2010}
Better Movie (2010).avi

Becomes

Movies
Good Movie (1999)
Good Movie (1999).mp4
Good Movie (1999) eng.srt
Better Movie (2010)
Better Movie (2010).avi

A big Yes to both your queries. I would like to:
1 - go to a certain folder, select-all, then click a button to rename those directories, but not directories inside them
2 - For each directory, I would like its name to be the same as the largest file directly below the directory.

Thank you in advance,
Stu.

Here's a rename preset which does that:

Thank you very much Leo, that preset worked perfectly :smiley:

1 Like