View previous topic :: View next topic |
Author |
Message |
kc27
Joined: 23 May 2007 Posts: 9
|
Posted: Wed Aug 08, 2012 6:48 pm Post subject: Need to Add leading Zeros |
|
|
I have a folder that contains files named in this fashion:
62-01p00-01.log
30722-01p00-01.log
I would like to be able to search for all files that are less than 5 digits before the first dash, and add leading zeros to bring it up to a 5 digit number. So that
62-01p00-01.log would become 00062-01p00-01.log but PFrank would ignore files named 30722-01p00-01.log because it is already 5 digits
Does anyone have any ideas on how to accomplish this? |
|
Back to top |
|
|
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Fri Aug 10, 2012 3:16 pm Post subject: |
|
|
There is a pre-defined regex called 'Pad Numbers to 5 digits' that can be used as a template.
I came up with the follwoing modified version that might work for you.l Copy and paste the following lines into the Custom renaming creator window (do not include the single quotes):
Row: 1
Search: '(?x1) ^([0-9])([-].*) # pad 1 digit number'
Replace: '0000\g<1>\2'
Row: 2
Search: '(?x1) ^([0-9]{2,2})([-].*) # pad 2 digit number'
Replace: '000\g<1>\2'
Row: 3
Search: '(?x1) ^([0-9]{3,3})([-].*) # pad 3 digit number'
Replace: '00\g<1>\2'
Row: 4
Search: '(?x1) ^([0-9]{4,4})([-].*) # pad 4 digit number'
Replace: '0\g<1>\2'
Hope that helps,
Peter. |
|
Back to top |
|
|
|