May be an easy one but need photos renamed
I have this:
1 (1).jpg, 1 (2).jpg, 1 (3).jpg
2 (1).jpg, 2 (2).jpg
3 (1).jpg, 3 (2).jpg, 3 (3).jpg, 3 (4).jpg
I need this:
1-1.jpg, 1-2.jpg, 1-3.jpg
2-1.jpg, 2-2.jpg
3-1.jpg, 3-2.jpg, 3-3.jpg, 3-4.jpg
I can use the basic rules to remove the brackets and add a number, but I cannot figure out how to reset the added number for each photo number group, so I end up with this:
1-1, 1-2, 1-3, 2-4, 2-5, 3-6, 3-7, 3-8, 3-9, etc
Can someone help?
1 (1).jpg, 1 (2).jpg, 1 (3).jpg
2 (1).jpg, 2 (2).jpg
3 (1).jpg, 3 (2).jpg, 3 (3).jpg, 3 (4).jpg
I need this:
1-1.jpg, 1-2.jpg, 1-3.jpg
2-1.jpg, 2-2.jpg
3-1.jpg, 3-2.jpg, 3-3.jpg, 3-4.jpg
I can use the basic rules to remove the brackets and add a number, but I cannot figure out how to reset the added number for each photo number group, so I end up with this:
1-1, 1-2, 1-3, 2-4, 2-5, 3-6, 3-7, 3-8, 3-9, etc
Can someone help?
Reply to #1:
Hi Steve,
If I understand, this should do the trick:
Replace method:
Replace: (\d+) \((\d+)\)
Replace with: $1-$2
Occurrence: All
Use regular expressions: Checked
Apply to: Name
That says to capture digit(s) at the start of the filename in group 1, capture digit(s) between parentheses in group 2, and replace the original with group 1 ("$1") plus a dash plus group 2 ("$2).
That way you are not "adding" a number, just using the numbers already there.
Let us know if that's what you need.
Hi Steve,
If I understand, this should do the trick:
Replace method:
Replace: (\d+) \((\d+)\)
Replace with: $1-$2
Occurrence: All
Use regular expressions: Checked
Apply to: Name
That says to capture digit(s) at the start of the filename in group 1, capture digit(s) between parentheses in group 2, and replace the original with group 1 ("$1") plus a dash plus group 2 ("$2).
That way you are not "adding" a number, just using the numbers already there.
Let us know if that's what you need.
Reply to #1:
Hi Steve,
You can certainly use the DF solution to understand the regex rules. However, in your case, the List replace method is a valid alternative. You need to replace "space+(" with a hyphen and replace ")" with nothing. See the image below:
https://i.postimg.cc/nhyWXb35/img198.png
Hi Steve,
You can certainly use the DF solution to understand the regex rules. However, in your case, the List replace method is a valid alternative. You need to replace "space+(" with a hyphen and replace ")" with nothing. See the image below:
https://i.postimg.cc/nhyWXb35/img198.png
Reply to #2:
This worked like a charm, thank you.
How could I modify this for filenames that have both a number and a letter?
For example, I have:
81A (1).jpg, 81A (2).jpg, 81A (3).jpg, etc
To get this:
81A-1.jpg, 81A-2.jpg, 81A-3.jpg
This worked like a charm, thank you.
How could I modify this for filenames that have both a number and a letter?
For example, I have:
81A (1).jpg, 81A (2).jpg, 81A (3).jpg, etc
To get this:
81A-1.jpg, 81A-2.jpg, 81A-3.jpg
Reply to #4:
Hey Steve,
First, Styb's answer in post #3 will still work for that, plus anything that has a space+paren-open, and a paren-close. That would be the way to go. Unless there was another space plus paren-open, of course.
If you need a method that will work with anything that has a space plus anything in parens at the end of the filenames, like
This is a filename, and it ends with a space plus parens (xxxyyy111).jpg
or
814344AEKDKcccc (sdlfksdl1111).jpg
EDIT: or 81A (1).jpg END EDIT
you can change the regular expression to
Replace: (.*) \((.+)\)$
Replace with: $1-$2
everything else the same. That just makes a group of any characters before the last space, then another group of anything in parens at the end of the filename (the "$" at the end anchors that last part to the tail-end of the filename).
Cheers!
DF
Hey Steve,
First, Styb's answer in post #3 will still work for that, plus anything that has a space+paren-open, and a paren-close. That would be the way to go. Unless there was another space plus paren-open, of course.
If you need a method that will work with anything that has a space plus anything in parens at the end of the filenames, like
This is a filename, and it ends with a space plus parens (xxxyyy111).jpg
or
814344AEKDKcccc (sdlfksdl1111).jpg
EDIT: or 81A (1).jpg END EDIT
you can change the regular expression to
Replace: (.*) \((.+)\)$
Replace with: $1-$2
everything else the same. That just makes a group of any characters before the last space, then another group of anything in parens at the end of the filename (the "$" at the end anchors that last part to the tail-end of the filename).
Cheers!
DF