Renaming Parent Directory?

A swapping-ground for Regular Expression syntax

Renaming Parent Directory?

Postby kdlklm » Wed Jan 18, 2012 6:08 pm

I'm trying to use a command line to rename the parent directory, or specific selected directory.

Code: Select all
C:\temp\rename\BRC32.exe /DIR:"C:\Movies\" /REGEXP:"(.+)(\d\d\d\d)":"\1(\2)" /REPLACECI:"((":"(" /EXECUTE


I want to be able to rename a specific folder as follows

From:
The Dark Knight Rises Prologue 2011 CAM NEWSRC XViD SIC

To:
The Dark Knight Rises Prologue (2011)

there are several directories under the same folder, but I only want to rename one.
kdlklm
 
Posts: 1
Joined: Wed Jan 18, 2012 6:03 pm

Re: Renaming ParDir?

Postby truth » Fri Aug 16, 2013 3:51 am

Without /recursive, that commandline only affects DirsNames 1-level below C:\Movies
To affect DirNames at the same level as C:\Movies, you must spec /dir:C: and /recursive
To select only certain DirNames, we must know your selection criteria
You should prob also be using /nofiles to prevent touching filenames

Below example affects ALL DirNames below C:\Movies (with space####space in DirName):
brc32 /dir:c:\movies /nofiles /recursive /regexp:"(.*) ([0-9]{4}) :\1 (\2)"

It will parenthesize the last 4digits(IfBorderedbySpaces) & drop anything afterwards
My FileName 2012 WasTooLong ---> My FileName (2012)
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to Regular Expressions