Page 1 of 1

Renaming files to uppercase

Posted: Tue Feb 03, 2015 3:11 pm
by kprice
For some reason, I can't seem to get this working with regex - here's what I'm trying to do:

<rename inputFilesVariable="${dstFiles}" whenFileExists="overwrite" searchPattern="(.*)\.(.*)" patternType="regex" replaceWith="${Upper(&apos;$1&apos;)}.$2" caseSensitive="true" version="1.0" />

When I try and run this, it doesn't fail, but it doesn't actually rename the files, either. It reports "0 file(s) were renamed successfully" and continues the rest of the script.

Right now, I'm starting to think that the Upper() function isn't compatible with regex replace - that or I'm making a mistake that I'm just not seeing.

Thanks ahead of time for your help.

Re: Renaming files to uppercase

Posted: Tue Feb 03, 2015 6:14 pm
by Support_Rick
The Rename Task doesn't work this way.

If you look into the Documentation (Blue ?) for the Rename Task, it notes at the bottom,
If you want to rename multiple files, then leave the Input File and New Name blank. On the Advanced tab of the Rename Task, add a File Name Prefix and/or File Name Suffix. Then define the File Set of files to rename by clicking the Action link in the sub-menu and selecting the Add a File Set menu item.
You might be able to do a ForEach loop across the file list and work with the files individually (rename each or call the command line var to rename) as an option.