Page 1 of 1

Rename Files with RegEx

Posted: 29 Nov 2014 00:52
by armsys

Code: Select all

D:\Views in sql server Part 39.pdf
D:\View limitations in sql server Part 42.pdf
D:\Updatable views in sql server Part 40.pdf
D:\Updatable common table expressions in sql server Part 50.pdf
D:\Unique key constraint - Part 9.pdf
D:\Unique and Non Unique Indexes in sql server Part 37.pdf
D:\Transactions in sql server Part 57.pdf
D:\IsDate, Day, Month, Year and DateName DateTime functions in SQL Server Part 26.pdf
D:\Instead of insert trigger Part 45.pdf
D:\Inline table valued functions in sql server Part 31.pdf
How to rename the above files with RegEx?
Goal: Replace "(title) Part ##.pdf" to "(Chapter ##) (title).pdf"
For example, the first filename above should become: D:\Chapter 39 Views in sql server.pdf
My RegEx (^\w*) Part (\d{1,2}) > Chapter $2 $1 fails.

Re: Rename Files with RegEx

Posted: 29 Nov 2014 01:26
by highend
If you really use the "Rename Special - RegExp Rename..."

Code: Select all

(^.*?)(\sPart\s)(\d{1,2}) > Chapter $3 $1

Re: Rename Files with RegEx

Posted: 29 Nov 2014 03:56
by armsys

Code: Select all

(^.*?)(\sPart\s)(\d{1,2}) > Chapter $3 $1
Your solution works like a charm. Thanks a lot.