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.
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+).