I have documents in some kind of format such as:
ABCXYZ 20090410 (DRAFT) JR.doc
ABCXYZABC 20090501.pdf
ABCXYZDEFG 7-19-10.doc
I would like those to end up like:
ABCXYZ 2009-04-10 (DRAFT) JR.doc
ABCXYZABC 2009-05-01.pdf
ABCXYZDEFG 2010-07-19
The third one may be difficult, since the "10" has to be recognized as the year "2010" and swapped to the front of the line. But if that's too much, could you help me with the first two? Just putting in hyphens after the 4th and 6th numbers so that I get a YYYY-MM-DD format instead of YYYYMMDD?
how to add inside my filename numbers?
Hi,
For the first two cases, you could use "regular expression" action
with the following expression:
^(.*)([0-9]{4})([0-9]{2})([0-9]{2})(.+)$
and the following as new name:
$1$2-$3-$4$5
(be sure to not leave a space at the end when pasting these lines)
For the 3rd case if the number of digits varies (1 or 2), it is probably possible, but much more complicated, and I am not good enough with regular expressions for that
For the first two cases, you could use "regular expression" action
with the following expression:
^(.*)([0-9]{4})([0-9]{2})([0-9]{2})(.+)$
and the following as new name:
$1$2-$3-$4$5
(be sure to not leave a space at the end when pasting these lines)
For the 3rd case if the number of digits varies (1 or 2), it is probably possible, but much more complicated, and I am not good enough with regular expressions for that

Yes, it will work, here is the explanation of the expression :
^ = beginning
(.*) = group of any characters (optional), including spaces
([0-9]{4}) = group of 4 digits
([0-9]{2}) = group of 2 digits
([0-9]{2}) = group of 2 digits
(.+) = group of any characters (at least one), including spaces
$ = end
So as long as there is a group of 8 digits somewhere, what is in front or after does not matter.
The $+number used in the new names are reference to each of the groups listed above
^ = beginning
(.*) = group of any characters (optional), including spaces
([0-9]{4}) = group of 4 digits
([0-9]{2}) = group of 2 digits
([0-9]{2}) = group of 2 digits
(.+) = group of any characters (at least one), including spaces
$ = end
So as long as there is a group of 8 digits somewhere, what is in front or after does not matter.
The $+number used in the new names are reference to each of the groups listed above
add this dialog to help file
Antoine, this dialog is a great clear example of how to use Regular expressions. You really should put it in the AntRenamer help file.
Current info about Regular expressions in help file and by a web link ibid is too detailed and complex to understand at a glance.
Current info about Regular expressions in help file and by a web link ibid is too detailed and complex to understand at a glance.
for the third one
using regular expression:
Expression:
^(.*)([0-9]{1,2})-([0-9]{1,2})-([0-9]{2,4})(.+)$
New name:
$1 $4-$2-$3$5
Result:
ABCXYZDEFG 7-19-10.doc
BE RENAMED TO :
ABCXYZDEFG 10-07-19.doc
but the main problem is how to rename "10" to "2010",and if add "20" in the frot directly , problem will come when year is "2010", confused too
waiting for the answer..
using regular expression:
Expression:
^(.*)([0-9]{1,2})-([0-9]{1,2})-([0-9]{2,4})(.+)$
New name:
$1 $4-$2-$3$5
Result:
ABCXYZDEFG 7-19-10.doc
BE RENAMED TO :
ABCXYZDEFG 10-07-19.doc
but the main problem is how to rename "10" to "2010",and if add "20" in the frot directly , problem will come when year is "2010", confused too
waiting for the answer..