I have a series of folders that my camera has made - as it uploads new photos. They are date specific and follow this format;
2004_22_05
(22nd May 2004)
And relate to the date on which the photos are taken.
My new camera (and Adobe Elements 5 import) names folders without the underscore, so this causes havoc when it comes to sorting.
I was looking for a way to rename all the old folders which have underscores to the same folder names, but without the underscore. I have tried to find a way to do this through the file command (rename) but with little success.
Can anyone tell me how to do this batch rename?
Many thanks.
You want to use Regular Expression (RegExp) from the Advanced Rename dialog.
Old Name: ([0-9][0-9][0-9][0-9])(_| |-)([0-9][0-9])(_| |-)([0-9][0-9])
New Name: \1-\3-\5
Old Name breaks down like this:[ol][li] b[/b] = The year
We use a tagged expression to isolate the numeric year portion of the date, it breaks down like this:[ul] [li] The parenthesis ( and ) affect the order of pattern evaluation, things inside them are evaluated before things outside of them. They also serve to tag an expression that can be used to isolate a matched sub-string. we will see how this can be used later in the New Name.[/li]
[li] [0-9] You wanted to match numeric dates. Enclosing a set of characters inside brackets [ and ] indicates that any of the enclosed characters may match the target character. In this case, we use a range to match any single character in the of range 0 through 9 inclusive. We use four of these in succession, because we want to match a four-digit year.[/li][/ul][/li][li] (_| |-) = The date separator.
We use this tagged expression twice to isolate any date separators within the date, it breaks down like this:[ul] [li] The parenthesis ( and ) affect the order of pattern evaluation, things inside them are evaluated before things outside of them. They also serve to tag an expression that can be used to isolate a matched sub-string. we will see how this can be used later in the New Name.[/li]
[li] The actual underscore character _ you want to remove.[/li]
[li] The vertical bar | works like a logical OR. Thus a|b means find a OR b at that character position.[/li]
[li] I have also included spaces " " as a possible date separator.[/li]
[li] I have also included hyphens - as a possible date separator.[/li][/ul][/li][li] b[/b] = The Day, which works just like the Year above, except it is only two digits.[/li]
[li] (_| |-) = The date separator again.[/li]
[li] b[/b] = The Month, which works just like the Year above, except it is only two digits.[/li][/ol]New Name breaks down like this:[ol][li] \1 = We want whatever we matched as the first tagged expression (The Year) to appear here.[/li]
[li] We want to use a hyphen - as a date divider.[/li]
[li] \5 = We want whatever we matched as the fifth tagged expression (The Month) to appear here.[/li]
[li] We want to use a hyphen - as a date divider.[/li]
[li] \3 = We want whatever we matched as the third tagged expression (The Day) to appear here.[/li][/ol]
You should be able to use the RegExp above to safely rename all of your folders regardless of who created them to not only ensure they have a hyphen as a date separator, but also to change the date format to one that is more conducive to sorting chronologically.
See the screen grab below.
Brilliant! thank you....
although I have to say that there was not a "Bush chance in Iraq" of getting it right on my own, so again, thanks for taking the time to reply.