Page 1 of 1

Wildcard in Batch Rename

Posted: 23 Jan 2016 21:14
by Snapfade
Hi,

I have thousands of files that Windows backup modified to include a timestamp. I want to batch remove that timestamp on all files but the time and date vary so I need a wildcard expression.

Original: My File (2015_11_06 23_34_08 UTC).txt
Replacement: My File.txt

The data between the parenthesis varies but ALL strings start with "(20" and end with "UTC)"

I tried this: (20*UTC)/ but the asterisk is not accepted as a wildcard. Nor does it work if I substitute several question marks to represent the other characters.

How can I rename thousands of files to eliminate this datestamp?

Thanks in advance for any suggestions you can offer.

Re: Wildcard in Batch Rename

Posted: 23 Jan 2016 22:50
by highend
All files have different "base" names (-> names that are not the same, when the (...UTC) get's stripped?

You should use a Regexp rename:

Code: Select all

\s*\(20.*?UTC\) > 
Attention, there is a trailing space after the ">" character!

The batch rename operation uses * for the base name of the file and the ? for it's extension...

Re: Wildcard in Batch Rename

Posted: 26 Jan 2016 02:21
by Snapfade
Correct, all base names are unique. thanks for the tip. I will give it a try. I appreciate your effort to help me!

Re: Wildcard in Batch Rename

Posted: 26 Jan 2016 02:29
by Snapfade
Thanks again, Highend; that code works perfectly!

Now, if I could understand it!!! Please tell me what is happening here if you have a minute. It looks like the base * and extention ? are stuck in the middle of the expression I am trying to get rid of.

Re: Wildcard in Batch Rename

Posted: 27 Jan 2016 09:52
by highend
It looks like the base * and extention ? are stuck in the middle of the expression I am trying to get rid of.
No, that comment was for "Batch rename", that you tried to use and why it wouldn't work

The regex expressions that I used looks for
- between zero and unlimited spaces
- followed by the opening parenthesis
- followed by 20, between zero and unlimited characters (but only get the least amount)
- followed by UTC and the closing parenthesis

and strips what it found from the string...