INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Syntax for regex mass rename files and folders  (Read 2721 times)

flydeep

  • Junior Woodchuck
  • **
  • Posts: 85
Syntax for regex mass rename files and folders
« on: January 29, 2015, 02:56:18 pm »

Hi - I have a relatively large collection of media that have tags in the folder and filenames, something like:
[- abc -] Foldername/- xyz -Filename.mp3

I would like to mass rename them to:
Foldername/Filename.mp3

I tried few options in Rename, move, replace library tool but guess need to use a regex to make this happen? Can someone point me to the right format for this?

Thanks!
Logged
--
Win 8.1 Pro (GTX 960, BENQ HT1075), Win 10 Pro (GTX 950, Sony KDLW900A) KVMs on Unraid 6.1.9, 8GB DDR3 +2 vCPU each, i7-4790, Asrock Z97 ex6, Denon 3313CI, Emotiva XPA5 amp, KEF Q900s, 600c, Mirage OMD15s, PSA 3x XS30SE

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Syntax for regex mass rename files and folders
« Reply #1 on: January 29, 2015, 03:06:34 pm »

If you right-click in the naming box, you can select which fields you want to use to rename the file from a list.
Without more specific examples of what the files are currently named, and what you want them to be, it's difficult to suggest anything more.
Logged

flydeep

  • Junior Woodchuck
  • **
  • Posts: 85
Re: Syntax for regex mass rename files and folders
« Reply #2 on: January 29, 2015, 09:08:18 pm »

I was able to make some progress for changing a pattern in the folder path. In my example above, I could easily change
[- abc -] Foldername/- xyz -Filename.mp3 to Foldername/- xyz -Filename.mp3

The second part of stripping the value "- xyz -" from the file name so that the result is Filename.mp3 requires a expression in RMC > Filename > Rule. This is where I requested help, what expression do I need to give here to strip a set of characters from the filename string?


If you right-click in the naming box, you can select which fields you want to use to rename the file from a list.
Without more specific examples of what the files are currently named, and what you want them to be, it's difficult to suggest anything more.
Logged
--
Win 8.1 Pro (GTX 960, BENQ HT1075), Win 10 Pro (GTX 950, Sony KDLW900A) KVMs on Unraid 6.1.9, 8GB DDR3 +2 vCPU each, i7-4790, Asrock Z97 ex6, Denon 3313CI, Emotiva XPA5 amp, KEF Q900s, 600c, Mirage OMD15s, PSA 3x XS30SE

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Syntax for regex mass rename files and folders
« Reply #3 on: January 30, 2015, 01:32:13 am »

Like that?



Folder rule: =removeleft(filefolder(),10)
Filename rule: =removeleft(removeright([filename (name)],5),7)

For the filename rule, if they are only three letter extensions, mp3, m4a, wma, etc., change the "5" to a "4"

-marko

flydeep

  • Junior Woodchuck
  • **
  • Posts: 85
Re: Syntax for regex mass rename files and folders
« Reply #4 on: January 30, 2015, 04:26:39 am »

This is exactly what I was looking for, thank you!

One question about the regex pattern, is the filename extension (in your example above, it's .flac) retained by the program and you need to pass only the manipulated file root name (like filename(1))? So I assume there is a way to change the file extensions also? Eg change .MKV to .mkv?

Thanks again!

Like that?



Folder rule: =removeleft(filefolder(),10)
Filename rule: =removeleft(removeright([filename (name)],5),7)

For the filename rule, if they are only three letter extensions, mp3, m4a, wma, etc., change the "5" to a "4"

-marko
Logged
--
Win 8.1 Pro (GTX 960, BENQ HT1075), Win 10 Pro (GTX 950, Sony KDLW900A) KVMs on Unraid 6.1.9, 8GB DDR3 +2 vCPU each, i7-4790, Asrock Z97 ex6, Denon 3313CI, Emotiva XPA5 amp, KEF Q900s, 600c, Mirage OMD15s, PSA 3x XS30SE

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Syntax for regex mass rename files and folders
« Reply #5 on: January 31, 2015, 12:35:42 am »

If you want to change the case of the extension, try the following:

Open the "Tag" window in the lower left corner of MC.
If the "Filename (name)" entry is not visible, then, in the tag window, right click > also show > Filename (name)"
Now that you see it, select one file then click in the "Filename (name)" field in the tag window to open it for editing.
Paste the following in there: =clean([filename (name)])
Press enter.

Is that what you want?
If the answer is yes, feel free to select as many files as you like and repeat the steps above. Note, with multiple files selected, the field in the tag window will display [Varies]. It's fine to open that for editing and follow the steps.

If the answer is no, press ctrl+z to undo whatever just happened, then post back explaining what you did, what happened, and why you're not happy. With a wing and a prayer, we should be able to get you sorted.

-marko
Pages: [1]   Go Up