_ (underscore) in file name

Everything related to MakeMKV
Post Reply
Hazimil
Posts: 2
Joined: Thu Feb 20, 2014 1:58 pm

_ (underscore) in file name

Post by Hazimil » Thu Feb 20, 2014 2:00 pm

Hi

Is there anyway to stop MAKEMKV putting in the underscore (_) instead of spaces in the file name (on Windows)? Just wonder if there's a way to stop me renaming the files afterwards :)

Yours
Jonathan

Woodstock
Posts: 10311
Joined: Sun Jul 24, 2011 11:21 pm

Re: _ (underscore) in file name

Post by Woodstock » Thu Feb 20, 2014 9:54 pm

This is a much-requested option...

For what it is worth, if you have expert mode enabled, you can edit the file names BEFORE you create the files.

Yugatha
Posts: 86
Joined: Fri Jun 08, 2012 1:20 am
Location: The Land Down Under

Re: _ (underscore) in file name

Post by Yugatha » Thu Feb 27, 2014 11:21 am

It may or may not help your circumstances, but I personally encode my rips afterwards with Handbrake, which automatically a) Replaces Underscores with Spaces, and b) up's the filename to title-case (ie Auto-Capitalises the first letter of each word. This also has the advantage of shrinking the video file with very little (if any) noticeable quality loss.

PaulCB
Posts: 75
Joined: Mon Mar 18, 2013 12:26 am

Re: _ (underscore) in file name

Post by PaulCB » Fri Feb 28, 2014 7:56 pm

Woodstock wrote:This is a much-requested option...

For what it is worth, if you have expert mode enabled, you can edit the file names BEFORE you create the files.
Agreed, I'd like to see it be the same as the name but at least it isn't a big deal to change (in expert mode anyway). Just a bit of cut and pasting now (create folder with name (Movie Name (year)), paste into name, paste into file name). Probably would be good for folks who don't know that mode exists to have it default that way. I don't know of any systems in use today that you would play it on that would have issues with long file names and spaces.

Smithcraft
Posts: 654
Joined: Mon May 02, 2011 8:56 pm
Location: Seattle, WA

Re: _ (underscore) in file name

Post by Smithcraft » Sat Mar 01, 2014 8:30 am

Yugatha wrote:It may or may not help your circumstances, but I personally encode my rips afterwards with Handbrake, which automatically a) Replaces Underscores with Spaces, and b) up's the filename to title-case (ie Auto-Capitalises the first letter of each word. This also has the advantage of shrinking the video file with very little (if any) noticeable quality loss.
Changing a file's name to title case is an option in Handbrake. I'm not sure which way the default is, but I have it disabled since I edit the source file name before I feed it to Handbrake.

SC

ant75
Posts: 20
Joined: Mon Nov 19, 2012 8:44 pm

Re: _ (underscore) in file name

Post by ant75 » Tue Nov 04, 2014 12:24 am

I would just Love to see this fixed as well. Becomes very annoying to have to keep renaming all the files to get rid of the underscores. Its just a small thing I guess but it need not be. We need this setup correctly by default. No further messing around. I don't want to have to go into the file name field and rename the file name output manually. I see that we can do this in MakeMKV but again it need not be setup this way. Simple and right setup by default would remove this whole bother, annoyance and unnecessary process. Just my two bits worth to help an otherwise great product.

Keep up the great developing Mike.

KiltedShane
Posts: 17
Joined: Thu Jan 03, 2013 7:37 pm
Contact:

Re: _ (underscore) in file name

Post by KiltedShane » Thu Dec 18, 2014 2:34 pm

Woodstock wrote:This is a much-requested option...

For what it is worth, if you have expert mode enabled, you can edit the file names BEFORE you create the files.
I always rename the tracks before I rip, but have _ in the file name anyway. I use the _ to help tell my MakeMKV files from files that have been run though handbrake.

michael-m.mueller
Posts: 12
Joined: Sat Aug 13, 2011 11:39 am

Re: _ (underscore) in file name

Post by michael-m.mueller » Thu Jul 30, 2015 9:42 am

KiltedShane wrote: I always rename the tracks before I rip, but have _ in the file name anyway.
... same to me, so why does MakeMKV still replace all the spaces or dots (and maybe more) in my output-filename with underscores, although I have renamed it before ripping?

mikeisfly
Posts: 2
Joined: Sun Nov 20, 2016 10:00 pm

Re: _ (underscore) in file name

Post by mikeisfly » Sun Nov 20, 2016 10:23 pm

Here is a script that I made to help with renaming the output files (replaces "_" with " " and deletes the "_txx") and moves the files into their own directories.

Code: Select all

<#
Arthor: Michael A. Gates
contact: mikeisfly on the makemkv forum

This file was created to make your life of backing up Blu-ray(s) and DVD(s) you legally own
a little more easier. I take no responsibility if you delete your files or cause any damamge to your 
System. Use at your own risk.

In order for you to execute this script follow the instructions below:

1. Copy code into your favorite text editor
2. Change the varible $dir1 to your direcotry
3. Save the file to whatever you you want with a .ps1 extension
4. Execute the script by typing the name of the script with the full path name
5. Enjoy!

*Note you may have to enable your system to run unsigned scripts by executing the following command 
from a powershell window: set-executionpolicy remotesigned

#>

<#

The purpose of this powershell script is to rename the output file from MakeMKV which uses "_"
in the filename and replaces them with a " " which looks much nicer. It will also get rid of 
the "_tXX" at the end of the file which indicates the track your ripped from your backup. 
Finially the script will create a folder based on the new filename and then move that file into that 
folder. If the files are already renamed then the script will just create a folder under the directory
which is defined by the $dir1 varible and move the matching file to that folder. I put logic in the 
script to ignore all files except those ending in .mp4 or .mkv

#>


$searchstring1="_" 
$searchstring2="_t"
$searchstring2reset=$searchstring2
$replacestring1=" "
$replacestring2=""
$dir1="f:\video" # Change this varible to the folder where your files are located
$FileExtension1=".mkv"
$FileExtension2=".mp4"
$fileEntries = [IO.Directory]::GetFiles($dir1)

foreach($fileName in $fileEntries)
{
	if ($fileName.Contains($FileExtension1) -or $fileName.Contains($FileExtension2))
    {
		$test=$fileName.subString(($fileName.length)-8,2)
        if ($test -eq $searchstring2)
            {
                $searchstring2=$fileName.subString(($fileName.length)-8,4)
                $fileNameTemp = $fileName.replace($searchstring2, $replacestring2)
            }
		    else{$fileNameTemp=$fileName}
        $fileNameTemp = $fileNameTemp.replace($searchstring1, $replacestring1)
		if (!($fileNameTemp -eq $fileName)){Rename-Item $fileName $fileNameTemp}
		$NewDir = $fileNameTemp -replace ".{4}$"
		if (!(Test-Path $NewDir))
        {
            if ($NewDir.Length -gt 0){New-Item -ItemType Directory -Force -Path $NewDir | Out-Null}
        }
		Move-Item $fileNameTemp $NewDir
        $searchstring2=$searchstring2reset
    }
}
 

Yugatha
Posts: 86
Joined: Fri Jun 08, 2012 1:20 am
Location: The Land Down Under

Re: _ (underscore) in file name

Post by Yugatha » Mon Nov 21, 2016 8:23 pm

Seeing as how this thread is revived anyway...

@mikeisfly... the script looks ok, but I'd like to make a few suggestions.
1) Check to mark sure the length is at least 8 before taking the substring. Not too sure how well Powershell would handle it, but at the worst case, it could mess up the operation of the script
2) It's rare, but there is the possibility of the _txx number to be 3 digits (ie _txxx) - maybe this could be implemented?
3) I'd suggest holding off on renaming the file until the move - ie, rename the file at the same time as the move. There is the (extremely rare, but possible) chance that the file "movie.mkv" exists when renaming "movie_t01.mkv" in the same folder. If you check to make sure it doesn't exist first, then move it, it would be much safer.

Apart from that, thanks for contributing!

mikeisfly
Posts: 2
Joined: Sun Nov 20, 2016 10:00 pm

Re: _ (underscore) in file name

Post by mikeisfly » Tue Nov 22, 2016 1:41 am

Yugatha wrote:Seeing as how this thread is revived anyway...

@mikeisfly... the script looks ok, but I'd like to make a few suggestions.
1) Check to mark sure the length is at least 8 before taking the substring. Not too sure how well Powershell would handle it, but at the worst case, it could mess up the operation of the script
2) It's rare, but there is the possibility of the _txx number to be 3 digits (ie _txxx) - maybe this could be implemented?
3) I'd suggest holding off on renaming the file until the move - ie, rename the file at the same time as the move. There is the (extremely rare, but possible) chance that the file "movie.mkv" exists when renaming "movie_t01.mkv" in the same folder. If you check to make sure it doesn't exist first, then move it, it would be much safer.

Apart from that, thanks for contributing!
All good suggestions, I will implement those as soon as I get sometime. Thanks for the ideas

SiliconDragon
Posts: 4
Joined: Wed Aug 03, 2016 2:30 am

Re: _ (underscore) in file name

Post by SiliconDragon » Sat Feb 25, 2017 4:26 pm

PITA++

I'm ripping my 4,000+ title library to my Plex server. These underscore chars are so friggin' annoying! Please, PLEASE give us a simple toggle setting to enable/disable the insertion of "_" chars.

I bet more people'd vote for this feature than there were peeps voting for the Trumpster. ;)

PS Ok, time to code a Windows Explorer extension so I can right-click on a file/folder and strip these chars. Seriously, it'll take me less time to code the app that the time spent replacing the char in all my files. (Do the math.)

Woodstock
Posts: 10311
Joined: Sun Jul 24, 2011 11:21 pm

Re: _ (underscore) in file name

Post by Woodstock » Sat Feb 25, 2017 7:33 pm

There are a couple of people who have independently written PowerShell scripts to rename the files, including one I remember that strips off the "_tNN" part. They were posted in the Advanced part of the forum.

I don't use any of them, 'cuz I manually rename things before they're ripped.

Post Reply