Rename then copy to same folder as source

Hello everyone,

I'm not an expert with regex at all, and I need your help :slight_smile:

here's what I want to do, I have hundreds of file like this :

[ul]file-002.txt
another-file-524.txt
one-more293-here-25.txt[/ul]

and want to rename them like this :

[ul]002-file.txt
524-another-file.txt
25-one-more293-here.txt[/ul]

But I want to keep the source file as is, I don't want to delete them, and they both have to be in the same folder at the end :

[ul]002-file.txt
524-another-file.txt
25-one-more-here.txt
file-002.txt
another-file-524.txt
one-more293-here-25.txt[/ul]

I'm using this regex to rename them, and it seems to be ok, i only need to keep a copy now :

old name : ([a-zA-Z0-9._%+-])(-)([0-9]).(.*)
new name : \3\2\1.\4

Thanks in advance for your help/advices.

You can try this... :unamused: But best solution must be exists...

dopusrt /cmd Copy TO CREATEFOLDER "{sourcepath}\temp" dopusrt /cmd Select RESELECT dopusrt /cmd Rename REGEXP PATTERN "([a-zA-Z0-9._%+-]*)(-)([0-9]*)\.(.*)" TO "\3\2\1.\4" dopusrt /cmd Copy move "{sourcepath}\temp\*.*" TO "{sourcepath}" dopusrt /cmd Delete "{sourcepath}\temp\" QUIET

  1. Ya might want to try doing a basic windows copy and paste command . This of course adds the prefix "copy of".

  2. Do a Regex to change around your filename.

  3. Do a REGEXP to remove the prefix.

*** must be in ABOVE order or else you may get naming conflicts***

Another code, a little faster:

Copy HERE AS *_DOpus_Temp Select PATTERN=*_DOpus_Temp Rename REGEXP PATTERN "([a-zA-Z0-9._%+-]*)(-)([0-9]*)\.(.*)(_DOpus_Temp)" TO "\3\2\1.\4"