Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Renaming with a RegEx

Jul
33
0
Hi,
I need to rename some files. My publishing system doesn't allow underscores. But, some software I use creates underscores when it splits PDFs into multiple files. I need to get rid of the underscores and simply replace them with the letter "p" for "page." But, the pages might have leading zeroes, and, I want to accommodate them, basically, by deleting them.

I'm trying this. These are my files.

test3-p536w3_01.pdf
test3-p536w3_02.pdf
test3-p536w3_03.pdf

ren ::_[0]{1,4} ::p

And, that doesn't work. I get this.

[F:\workflows\grafix\TM_PDF]ren ::_[0]{1,4} ::p
TCC: (Sys) There are no more files.
"F:\workflows\grafix\TM_PDF\::_[0]{1"
TCC: (Sys) The system cannot find the file specified.
"F:\workflows\grafix\TM_PDF\4}"
0 files renamed


It does work when I simply have the underscore alone replaced with the "p." But, not with the regex for one or more zeroes.

Thanks!
 
You probably have to quote the comma in some way. It looks like TCC is seeing ::_[0-]{1 as a file name and 4} as another file name, separated by the comma.
 

Similar threads

Back
Top