You are not logged in.
Pages: 1
hello i have these files sorted by month and then year, and they don't sort nicely in the computer by date (because month is first, instead of year). can anyone help me swap these, add an underscore, and add add a "20" to the front all in one go?
0310_us.txt => 2010_03_us.txt
another example
1109_au.txt => 2009_11_au.txt
see it has the month as the first two characters, and the year by the third and fourth character.
thanks! adam
Offline
Hi adam, welcome!
FROM:
0310_us.txt
1109_au.txt
TO:
2010_03_us.txt
2009_11_au.txt
USE an RegEx-Rule as follows:
RegEx:
expression "(\d\d)(\d\d)"
Replace with "20$2_$1"
(skip extension)
Explanation:
\d ==> is an RegEx to match one single digit
\d\d => will match two digits
(...) => will group what is matched for later reuse by "$1"
Ahh, and don't use that ""-quotes in real, they are only to clarify.
So we have two backreference groups we can reference to by using "$1" and "$2"
In the replacement we exchange this two groups from $1 $2 to $2 $1 and add literal text as "20" and "_"
The rest of the string is added by ReNamer automatically.
See the WIKI for more about this:
=> http://www.den4b.com/wiki/ReNamer:Rules for more about using Rules and
=> http://www.den4b.com/wiki/ReNamer:Regular_Expressions for more about the RegEx Syntax.
HTH?
If yes spread the word about ReNamer ... and help two others too and/or read my sig
Last edited by Stefan (2010-09-16 06:59)
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Thank you so so so much. I love it. It worked instantly. I Linked-In about ReNamer just now.
Offline
Pages: 1