#1 : 06/11-20 12:26 Roberto
Posts: 1
|
Hello
I've a list of about 38000 file .tif (scans of pictures) which are named in the following way: Example, Directory nr. 126 126-0001.tif (the front of the picture) 126-0001a.tif (the rear of the same picture) 126-0002.tif 126-0002a.tif 126-0003.tif (no rear for this picture) 126-0004.tif 126-0005.tif 126-0005a.tif 126-0006.tif 126-0006a.tif 126-0006b.tif (more than a scan of the same picture) I have to change the name of all these files starting from a new number (for example 35001) and I've to do this operation for each directory, starting from a new number. The result of the example should be the following: 126-0001.tif 35001a.tif 126-0001a.tif 35001b.tif 126-0002.tif 35002a.tif 126-0002a.tif 35002b.tif 126-0003.tif 35003a.tif 126-0004.tif 35004a.tif 126-0005.tif 35005a.tif 126-0005a.tif 35005b.tif 126-0006.tif 35006a.tif 126-0006a.tif 35006b.tif 126-0006b.tif 35006c.tif How can I do this operation? I've tried in different ways but with no success Thank for your help Roberto |
#2 : 08/11-20 11:26 David Lee
Posts: 1125
|
You haven't completely specified your problem but as described you can solve it using two steps...
Working on one directory at a time: 1) Use the Replace method to replace the leading 3 digits plus "-0" with a 2-digit new prefix 2) Use List replace to replace the final letter 1) Replace method... Replace: ^\d{3}-0 With: 35 (change as appropriate for each folder) Use regular expressions 2) List replace method with 3 lines... Replace: b$ with: c Replace: a$ with: b Replace: (\d)$ with: \1a |