How can I rename specific files in a folder with folder name

Bulk Rename Utility How-To's

How can I rename specific files in a folder with folder name

Postby Ronstang » Mon Sep 11, 2023 12:46 pm

I only want to rename .mkv, .nfo, .bif and .srt files but if the .srt files have a language modifier like .eng.srt the renaming has to be before the language modifier.

Is this possible?

Thanks
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am

Re: How can I rename specific files in a folder with folder name

Postby therube » Mon Sep 11, 2023 5:34 pm

Example of what you have & what you're trying to do?

As it is, with ".eng.srt", the file extension is ".srt".
".eng" is part of the file name.

If you want to remove the ".eng" part, 3:Replace, Replace: .eng, With: <leave blank>

Code: Select all
The Blues Brothers (1980) TCMSLBM-C.eng.srt
->   The Blues Brothers (1980) TCMSLBM-C.srt
The Blues Brothers (1980) TCMSLBM-C.mkv
->   The Blues Brothers (1980) TCMSLBM-C.mkv
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: How can I rename specific files in a folder with folder name

Postby Ronstang » Tue Sep 12, 2023 5:06 am

Thank You, but I am not trying to remove the language modifier, I am trying to rename certain files in the folder with the folder name, but not all the files. So if the folder name is:

Scream and Scream Again (1970) TCMFPDK+5

And the folder contains the following files:

Scream and Scream Again.Eng.srt
Scream and Scream Again.Spa.srt
Scream and Scream Again.mkv
Scream and Scream Again.nfo
Scream and Scream Again-320-10.bif
fanart.jpg
landscape.jpg
poster.jpg

I want to rename them as follows:

Scream and Scream Again (1970) TCMFPDK+5.Eng.srt
Scream and Scream Again (1970) TCMFPDK+5.Spa.srt
Scream and Scream Again (1970) TCMFPDK+5.mkv
Scream and Scream Again (1970) TCMFPDK+5.nfo
Scream and Scream Again (1970) TCMFPDK+5-320-10.bif
fanart.jpg
landscape.jpg
poster.jpg

So I only want to rename the .mkv, nfo,, .bif files and the .srt files, retaining the language modifier. I have already redone all the folders to have the correct info as I want it and I have thousands of folders full of files to do so manual is rather arduous.

Thanks.
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am

Re: How can I rename specific files in a folder with folder name

Postby therube » Tue Sep 12, 2023 7:05 pm

As a start

12:Filters
- enter your file extensions, separated by a space (*.srt *.mkv *.nfo ...)

Then, a big IF
- if your file names do not include dots (.) - except for extension, or lang.srt.ext

then you can do something like

1:RegEx, enable, Simple
Code: Select all
Match:  %1.%2
Replace:  .%2

(effectively removes the name part (%1), while also leaving the lang.srt)

9:Append Folder Name, Name: Prefix


See if something like that can work for you?
Test small, & on backups.


Ah, that's going to fail on "-320-10.bif".
Well, see if at least all but *.bif will work?
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Preserve ending -digits or .languageID to .mkv/nfo/bif/srt

Postby Luuk » Wed Sep 13, 2023 3:51 am

Like therube is saying, it looks like more text should be preserved, than besides just the language-id's ??
But there is many different ways to only rename the files, when their extensions are .mkv/nfo/bif/srt.

Probably the easiest way is using Filters(12) with a "Mask" like *.mkv *.nfo *.bif *.srt
Then click the blue-arrows besides "Mask" to filter everything else away from the file-listing.

To only preserve ending strings like -2orMoreDigits, and ending language-id's like .eng|.spa|.rus ??
Can use the RegEx(1) with a checkmark inside for "IncExt", so then a "Match" and "Replace" like...
.+?(((-\d{2,})+)?(?i)(\.(eng|spa|rus))?)(\.(mkv|nfo|bif|srt))$
\1

Regex(1) wont edit names with other extensions, but AppendFolderName(9) edits anything selected in the file-listing.
This why I'm thinking its better to also conduct the "Mask", so then not having to be careful with your selections.
Remember, this does remove the beginning (and maybe whole filename) to any of your .mkv/nfo/bif/srt files!
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: How can I rename specific files in a folder with folder name

Postby Ronstang » Thu Sep 14, 2023 4:59 am

Thank you so much therube.....that worked great on one batch of files that didn't have any bif files so I didn't have to worry about the -320-10 being an issue and I just passed over files with a period somewhere in the filename. Much appreciated.

Thanks Luuk, your suggestion works with files that have periods in the filename but I may have entered something wrong because it doesn't preserve the actual file extension so it wants to rename all the files in a folder the same...with just the folder name. Any ideas what I could have done wrong?
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am

Preserve ending -Digits or .LanguageID in .mkv/nfo/bif/srt

Postby Luuk » Thu Sep 14, 2023 7:40 am

@Ronstang...
1) Your suggestion works with periods in the filename...
The "Match" requires .LanguageIDs to preserve them, then either .mkv/.nfo/.bif/.srt at the extension, but not anywhere else.
If needing to also preserve LanguageIDs at the end, can just add "?" right after the blue \. inside of the match.

2) It doesn't preserve the actual file extension...
RegEx(1) cant edit extensions, unless putting a checkmark for "Renaming Options, File/FolderExtensions, Rename File Extension".

3) It wants to rename all files per folder the same...
RegEx(1) will only edit the mkv/nfo/bif/srt-files, preserving the ending .LanguageID or -2orMoreDigits like the examples?
AppendFolderName(9) edits anything that's selected, so conducting the "Mask" is better than being careful with selections.

4) Any ideas what I could have done wrong?...
Probaby just simple things, like putting checkmarks for "v2" or maybe the menu "Rename File Extensions".
If manually editing the "Match", I like using a text editor that lets me change both the colors and text-size.
Or maybe a glitch? Sometimes after changing settings, I will exit and then restart, to make sure it was saved.
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: How can I rename specific files in a folder with folder name

Postby Ronstang » Thu Sep 14, 2023 2:41 pm

Thanks as always Luuk, you hit it right on the head again. It's working perfectly now. You guys and this program save me so much time, I just wish I understood enough to know how all these parameters work.
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am


Return to How-To