Rename to remove Date/Time/Zone?

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename to remove Date/Time/Zone?

Postby Heretictus » Sun Mar 10, 2019 3:15 am

I'm hoping for some help. I've lost a substantial amount of hair trying to figure this out, and online regex generators haven't been very helpful :( After a disk crash, I copied files from two backups. The newer backup restored file names correctly, but the files I recovered from an old backup have names appended with date/time/zone, such as the following examples:

File Name (2015_12_21 19_28_46 UTC).docx
Longer_File_name (2016_01_30 07_16_32 UTC).jpg
File-name (9-5) XXXXXXX (1)(2014-09-02 09-27-03 UTC).xlsx
File Name.pdf (example of correctly restored file in same directory)

I have a couple hundred directories in this condition, and the folder names have been changed as well. How do I go about stripping off the "(2014-09-02 09-27-03 UTC)" including the leading space if there is a leading space?

Any suggestions or help would be greatly appreciated. Thanks!
Heretictus
 
Posts: 2
Joined: Sun Mar 10, 2019 2:53 am

Re: Rename to remove Date/Time/Zone?

Postby therube » Sun Mar 10, 2019 6:15 pm

See if this does it...


1:RegEx
Code: Select all
Match:  (.*)(\(\d\d\d\d.*UTC\)$)
Replace:  \1


5:Replace -> Trim (box, checkmark)


(You gave two types of UTC dates, _ & -, so I just took the cheap way out.)
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename to remove Date/Time/Zone?

Postby Heretictus » Wed Mar 20, 2019 1:42 am

You may have taken the cheap way out, but I got a solution that fixed my problem for free! Your solution worked perfectly.

Many thanks, my friend. Much appreciated!
Heretictus
 
Posts: 2
Joined: Sun Mar 10, 2019 2:53 am


Return to BRU Support