Renumbering files and folders

Hi folks, I would like to renumber files or folders in positions that may not necessarily be as a suffix similar to the structure below. I would like to know how to renumber E50 to some other number like E49 and the rest of the files or folders would change accordingly. I can perform the function using Bulk Renamer but would like to continue using DO for such tasks.

XFiles_S3_E50_(09-22-95)The_Blessing_Way
XFiles_S3_E51
(09-29-95)Paper_Clip
XFiles_S3_E52
(10-06-95)D.P.O.
XFiles_S3_E53
(10-13-95)Clyde_Bruckman's_Final_Repose
XFiles_S3_E54
(10-20-95)_The_List

Also, would like to be able to setup renumbering as a prefix whether it be a file or folder such as:

xxx1.jpg to 001_xxx.jpg
yyy2.jpg to 002_yyy.jpg
zzz3.jpg to 003_zzz.jpg

or

folder1 to 001_folder
folder2 to 002_folder

Can this be done and if so can you help with the setup. Any help would be greatly appreciated.

Thank you

If you want to use my Dynamic Renamer (version 1.8), it can do both of your tasks. Let me know if you'd like an explanation of how these both work.



Thank you for the reply MrC. I do have your Dynamic Renamer already functional on my PC and would appreciate an explanation of how these both work.

OK, be sure to get the version (1.8) I just posted. You'll need it to perform the above.

For the first one, the solution uses the Dynamic Renamer substitution transformation: -/oldpat/replacement/

-/(_E)(\d+)/$1 . ($2 - 1)/e

This uses a single perl substitution. We're replacing the _E with itself, but 1 is being subtracted from the first. The /e flag is allowing the substitution to evaluate a perl expression. Example: _E40 --> _E39.

The second one uses two Dynamic Renamer transforms: one to zero pad numbers (-z) and the other is a perl substation, moving the digits to the front:

-/^(.*\x3F)(\d+)/$2_$1/ -z3

First the substation grabs as little as possible from the front of the string, followed by some digits, and swaps the two with an underscore in between. And then the next transformation -z3 zero pads the first number sequence it finds.

Note: DOpus doesn't allow entering a ? into the New name field (since it is an illegal file system character), but this RE needs it, so we're passing in the hexidecimal escape equivalent of \x3F. So the RE really is just (.*?)(\d+).