Rename by "cutting" characters and "pasting" them at the end

Hi all,

this is my first post. I have to batch rename a lot of files in that manner:

let's say the file name is "1982 - The Thing.avi" and I would like to rename it "The Thing (1982).avi" (...and all files would have the same beginning format, that is, a year (4 characters), a space, a "-" and a space)

My guess is it could be done with a script but...honestly, I don't have a clue how...anybody can help me with this?

While we're at it, is it possible to batch rename folders, the same name as the file in it? (or vice-versa)

Example: ...\Movies\The Thing\The Thing (1982).avi to become: ...\Movies\The Thing (1982)\The Thing (1982).avi (and obviously, the folder name NOT getting the ".avi" from the file name)

Thanx a lot in advance!

Stef

This works but MrC will give you a better solution.


[quote="sbalbarbin"]Hi all,
While we're at it, is it possible to batch rename folders, the same name as the file in it? (or vice-versa)

Example: ...\Movies\The Thing\The Thing (1982).avi to become: ...\Movies\The Thing (1982)\The Thing (1982).avi (and obviously, the folder name NOT getting the ".avi" from the file name)[/quote]

Will that avi be the only file in the folder? You'll be selecting the folders that you want renamed, w/out selecting the avi files. But in this case, where does the Rename get the base name from (since no files are selected from which to grab the file name)?

Or, you can select only the files (in flat view) and Rename their folder paths - but what about other files within the folders?

This might be the case where a script is required.

Thank you very much blueroly, that does the trick perfectly (you just saved me hours :wink: )

Stef

Hi MrC,

yes, the folder would contain just one file. And yes, that's what puzzled me, the fact that "where does the Rename get the base name from (since no files are selected from which to grab the file name)"

I have noticed that when we select a Folder, the "Rename" button is greyed out...

The Script blueroly gave me will work for my files (by selecting the parent folder that contains all the sub-folders of the movies), making a search . it then gives me all the movies and I do the script....all my movies are now renamed...now it would be the folders turn...(to be renamed as the file name in each)

...I'm pretty sure too this would have to be a script...

Stef

So if you're only worried about the single file in a folder, then you can do the rename as follows.

  1. Go into Flat View (no Folders).
  2. Select the files you want renamed (you can group/sort these if you want by Location column).
  3. Rename using the following settings:

Type: Regular Expression
Old name: (.)(..)
New name: ..\\1\\1\2

This will rename the files by moving them to new folders (which you'll see in the preview window).

Note: you may have left-over folders when hidden files exist, hence my questions above in the previous post.

Thanx MrC,

that works like a charm!

Stef

You're welcome. By the way, you can combine these two regular expressions into a single Rename call. Maybe you'd like to try working that out. :slight_smile:

Here's my best effort... is there any way to improve this MrC?


Looks great!