rename filename (999) with filename yyyymmdd hhss

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

rename filename (999) with filename yyyymmdd hhss

Postby dianedebuda » Tue Apr 23, 2013 1:43 am

Want to "reverse" Win7 copy replace/rename conflict dialog renames "filename (999).xxx" with "filename yyyymmdd hhss.xxx". The "new" style ending is straight-forward, but do not see how to id the orig "root" name, which may have "(" chars already in it. Possible with BRU?
dianedebuda
 
Posts: 4
Joined: Tue Apr 23, 2013 1:25 am

Re: rename filename (999) with filename yyyymmdd hhss

Postby Stefan » Tue Apr 23, 2013 6:52 am

FROM:
filename01 (1).ext
filename02 (2).ext
filename03 (3).ext
filename04 (9).ext
filename05 (91).ext
filename06 (92).ext
filename07 (99).ext
filename08 (997).ext
filename09 (998).ext
filename10 (999).ext

TO:
filename01.ext
filename02.ext
filename03.ext
filename04.ext
filename05.ext
filename06.ext
filename07.ext
filename08.ext
filename09.ext
filename10.ext

Rule:
-- match everything till "an space, followed by an opening parentheses, followed by the rest"
-- store this match into an backreference group (...)
-- replace whit what is stored in backreference group \1 onyl, dropping the rest
Note: since the opening parentheses is an RegEx meta-char we have to escape him by a leading backslash \( to match a literal opening parentheses.

USE:
RegEx(1)
Match: (.+) \(.+
Repla: \1




Ahh, of course,... this will work also to remove parentheses and text in between:

Remove(5)
Crop [Special][ (*)]



.
.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: rename filename (999) with filename yyyymmdd hhss

Postby dianedebuda » Tue Apr 23, 2013 11:47 am

Thanks, but think this will be a problem if source filenames are like "filename v1.11 (test) (1)", "filename v1.11 (test) (2)", ... "filename v1.11 (test) (999)". Need rule to apply only to "(999)" chars before "." of ext.
dianedebuda
 
Posts: 4
Joined: Tue Apr 23, 2013 1:25 am

Re: rename filename (999) with filename yyyymmdd hhss

Postby Stefan » Tue Apr 23, 2013 12:47 pm

Then remember next time to provide proper example file names if you want working solutions.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: rename filename (999) with filename yyyymmdd hhss

Postby dianedebuda » Tue Apr 23, 2013 1:03 pm

Sorry. Thought I had covered that when I said "(" might be in root file name.
dianedebuda
 
Posts: 4
Joined: Tue Apr 23, 2013 1:25 am

Re: rename filename (999) with filename yyyymmdd hhss

Postby Stefan » Tue Apr 23, 2013 2:23 pm

Since my RegEx works greedy and will match the very last occurrences of
an opening parentheses, your second examples may be no problem for us also.


Ah, that "Remove(5)" won't work for this second provided examples, I guess. (At least not the way you want it)




.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: rename filename (999) with filename yyyymmdd hhss

Postby dianedebuda » Tue Apr 23, 2013 5:21 pm

And the ending numeric may be from 1 to 3 digits such as (1), (12), (123). So, if I understand the remove(5) correctly, that would force killing the last 5 chars, no matter what they were. I'm really sorry I didn't provide such details to begin with; I made the foolish assumption that by saying it was generated by the Windows copy conflict box, the format would be known. My apologies.
dianedebuda
 
Posts: 4
Joined: Tue Apr 23, 2013 1:25 am


Return to BRU Support