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.
Wildcard in Batch Rename
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Wildcard in Batch Rename
All files have different "base" names (-> names that are not the same, when the (...UTC) get's stripped?
You should use a Regexp rename:
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...
You should use a Regexp rename:
Code: Select all
\s*\(20.*?UTC\) > The batch rename operation uses * for the base name of the file and the ? for it's extension...
One of my scripts helped you out? Please donate via Paypal
-
Snapfade
- Posts: 5
- Joined: 23 Jan 2016 20:57
Re: Wildcard in Batch Rename
Correct, all base names are unique. thanks for the tip. I will give it a try. I appreciate your effort to help me!
-
Snapfade
- Posts: 5
- Joined: 23 Jan 2016 20:57
Re: Wildcard in Batch Rename
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.
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.
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Wildcard in Batch Rename
No, that comment was for "Batch rename", that you tried to use and why it wouldn't workIt looks like the base * and extention ? are stuck in the middle of the expression I am trying to get rid of.
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...
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club