I have ~2000 files in an original naming scheme.
I need to take them all, move the first 4 characters to the end of the filename before the extension, and then add a whitespace before the first 4 characters.
Basically, from:
0123 [UNKNOWN] (Final Fantasy 9) headshot of Freya Crescent {sketch} (ORIGINAL).jpg
to
[UNKNOWN] (Final Fantasy 9) headshot of Freya Crescent {sketch} (ORIGINAL) 0123.jpg
Best Answer
This should work:
Sample:
Results:
Note: Tested with
.txt
files will also work on jpg filenamesInformation:
([0-9]+)
: pick the numbers at the front.(.*)
: pick every other thing till the file extension.$2 $1.txt
: return the captured groups with the returned group fornumbers
placed close to the file extensionjpg
and add a space before the numbers.-n
: run without changing filename so we see what files are changed and what the names are changed to, remove this to rename the files.