Rename files using their parent folder


"C:\Movies\Random Movie Title\orc.random.dvdrip.avi"

renamed to:

"C:\Movies\Random Movie Title\Random Movie Title.avi"

the reason i want this is i have already made an extensive multi-regexp script to rename any movie's folder that i download to just be the movie title and nothing else. however, the actual video files are usually abbreviated and in no proper format. I'd like to just rename the movie files using their parent folder that i've already had my script fix for me. anyone got any ideas?

Use "Enable file information fields" options in the rename dialog

[Admin: I replaced the image with one showing the same thing but not so wide. --Leo]

that works great, one more question. is there any way to set it up to automatically retain the cd1/cd2 suffix on certain files without manually altering the rename fields each time?

i have a button set up to run my main rename script for the folders on left click and i'd like to set it up to run this parent folder rename as the right click option for that button.

You mean something like this? You can combine the file information fields with regular expressions.

thats exactly what i needed, ty very much!

on that note, is there a way to set it so that if it sees a cd1 or cd2 or cd3 that it renames it accordingly? the last example only affects the cd1 file and does not touch the cd2 file

Just change cd1 to cd. in the Old Name string.

Or, if you want it to handle multiple digits, use cd[0-9]+ (which also works with a single digit, of course).

This is very close to something I need, but I need some way to parse out {parent1} as in:

artist - album/title.mp3


artist - album/artist - title.mp3

I need to get the first half of {parent1} and ditch the other half. Can I do this?

[quote="Perseid"]artist - album/title.mp3
artist - album/artist - title.mp3[/quote]

If the music files are tagged then renaming based on the tags is probably easier. See the 11th example here:

[ul][li]Various simple rename presets[/li][/ul]

Unfortunately they're not tagged.

In that case the easiest thing is probably doing it in two steps.

[ul][li]Step 1: Do one rename which copies the parent folder name into the file names:

From: *
To: {parent1} XX *
Type: Standard rename
File Info Fields: Enabled

(So you get "Artist - Album XX Title.mp3")
[li]Step 2: Do another rename which removes the unwanted part:

From: b - (.) XX (.)[/b]
To: \1 - \3
Type: Regular Expressions
File Info Field: Disabled (doesn't really matter but might be faster to disable them)

(So you get "Artist - Title.mp3")[/li][/ul]

There's nothing special about the XX part; it's just used as a marker to know what to remove. You could use any characters that are unlikely to appear in the real names.

You could do this in a single rename step, but I think doing that would require some VBScript or similar which would make it a lot more complex.

Just wondering, is there a way that I can keep the numbers on each file?

I want to rename using the parent folder, and delete whatever name it was previously but keep any numbers the file might have.

So if a file is
xx454xx.avi - it'd become 454.avi

And I'd use the parent folder name in front the numbers.

Here's one way to do it. If you don't care about all the different cases then you can use a much simpler regexp but this one handles all the situations I could think of:

Old name: (|(.*[^0-9]))([0-9]+)(|([^0-9].*))(\.[^.]*)

New name: {parent} \3\6