Rename if

Advanced Renamer forum
#1 : 25/03-24 14:02
Dan Nielsen
Dan Nielsen
Posts: 4
How do i rename with "if". I want to rename a total filename if ex. "exportGif" is in the filename. ex. "Monkeyglasses Berlin 11_40_[360G 24-exportGif].gif" should be renamed Monkeyglasses Berlin 11_40_exportGif.gif.

I have many folders i like to rename every folder is named the product name and has 26 files in every folder. 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg, 4.jpg, 5.jpg, 6.jpg, 7.jpg, 8.jpg, 9.jpg, 10.jpg, 11.jpg, 12.jpg, 13.jpg, 14.jpg, 15.jpg, 16.jpg, 17.jpg, 18.jpg, 19.jpg, 20.jpg, 21.jpg, 22.jpg, 23.jpg, 24.jpg, exportGif.gif, clip.mp4

Problem 1: All files has to have the name of the folder
Problem 2: Files need to have "[360G 24-" and "]" arround the file name
Problem 3: File number has to be 2 digits ex. 2.jpg need to be 02.jpg
Problem 4: 2 files in every folder need to have another name (no numbers) exportGif.gif and clip.mp4

How i want it:
(ex. folder name= "Monkeyglasses Berlin 11_40")
Monkeyglasses Berlin 11_40[360G 24-01].jpg
Monkeyglasses Berlin 11_40[360G 24-02].jpg
...
Monkeyglasses Berlin 11_40[360G 24-24].jpg
Monkeyglasses Berlin 11_40_exportGif.gif
Monkeyglasses Berlin 11_40_clip.mp4

How to do that?


25/03-24 14:02
#2 : 25/03-24 16:50
Styb
Styb
Posts: 80
Reply to #1:
I understand that you are asking two questions.

1) Renaming if "exportGif" is in the filename
2) Renaming JPGs, GIFs and MP4s by folder

1) I think the easiest way to do this is to use the Explorer search box in the right-hand corner of the 'Add Files' dialogue box.
Type name:~=exportGif in the search box, select all resulting files, click Open. Note: for the English version of Windows, use the word 'name'; for other languages, use the appropriate translation of 'name'.

Use the Replace method

Text to be replaced: [*]
Replace with: exportGif

Then, check the new filenames and start the batch.

2) This task can be completed in two steps: a) renaming JPGs and b) renaming GIFs/MP4s

a)Add folders, by using the following mask: *.jpg

Use the New name method, and type
<foldername:1>[360G 24-<Inc NrDir:1>]

Then, check the new filenames and start the batch.

b)Add folders, by using the following mask: *.gif;*.mp4

Use the Add method
Add:<foldername:1>_
At index: 1

Then, check the new filenames and start the batch.


25/03-24 16:50 - edited 25/03-24 17:16
#3 : 25/03-24 17:37
Delta Foxtrot
Delta Foxtrot
Posts: 106
Reply to #1:

Hi Dan,

If each folder holds the name you want in your filename and the part in parenthesis is consistent across all products, then that's easy. I don't know how much experience you have with Advanced Renamer, or Regular expressions, but we're going to string together a couple of methods to get you where you want. (If all folders are the same pattern you can change as many files as you want with each batch run. I'm not sure where the "[360G 24-]" comes from, or if it changes for each folder; if it changes you have another problem, but I'm going to give you the answer to the question that you actually asked. Possibly you'll realize you didn't quite explain exactly what you need; if that's the case, just let us know. That happens a lot here. I do it as much as anyone. :) )

1. Add your files. Make sure they are sorted on the filename, so all numbers are ascending. Don't worry if you have a bunch of 1.jpg's together, etc. We'll deal with that, but we need the files in each folder to be consecutively ascending.

2. Add a "REPLACE" method. Put exactly this in:

Text to be replaced: ^([\d]{1,2})?(clip|exportGif)?
Replace with: <Foldername:1>[360G 24-<IncNrDir>]$2
Case sensitive NO
Use regular expressions YES
Apply to: Name
(If the incrementing numbers lack the zero padding on 1 to 9 in the "New Filename" preview column after entering this method, you'll need to go to "Settings/Renaming" and tick the "zero padding on IncNr" box. I think it's default, but not sure.)

3. Add another "REPLACE" method. Put exactly this in:

Text to be replaced: ([^\[]+)\[\d{3}\w \d\d\-\d\d\](clip|exportGif)
Replace with: $1_$2
Case sensitive NO
Use regular expressions YES
Apply to: Name

That'll do it. Make sure not to put any spaces before or after the stuff.

Best,
DF


25/03-24 17:37
#4 : 25/03-24 17:38
Delta Foxtrot
Delta Foxtrot
Posts: 106
Reply to #3:

Oh, hi Styb. I was busy composing an answer and didn't "see" you there. Have a great day!

Best regards,
DF


25/03-24 17:38
#5 : 25/03-24 20:25
Miguel
Miguel
Posts: 60
Reply to #1:
Use the Replace method
REPLACE: [*-exportGIF]
REPLACE FOR: _exportGIF
The files that don´t have "exportGIF" in the name do not will be renamed.


25/03-24 20:25
#6 : 27/03-24 14:16
Dan Nielsen
Dan Nielsen
Posts: 4
PERFECT!!! That was just what i was looking for :)
I had the other things handled but could not finde a method to replase like that
Thanks so much!!! :)


27/03-24 14:16
#7 : 27/03-24 14:17
Dan Nielsen
Dan Nielsen
Posts: 4
Thank you so much for trying to help!

The thing i was struggeling was sulved with this :)
Use the Replace method
REPLACE: [*-exportGIF]
REPLACE FOR: _exportGIF
The files that don´t have "exportGIF" in the name do not will be renamed.

Sorry if i was not beeing percise

Have a nice day :)



27/03-24 14:17
#8 : 27/03-24 14:18
Dan Nielsen
Dan Nielsen
Posts: 4
Thank you so much for trying to help!

The thing i was struggeling was sulved with this :)
Use the Replace method
REPLACE: [*-exportGIF]
REPLACE FOR: _exportGIF
The files that don´t have "exportGIF" in the name do not will be renamed.

Sorry if i was not beeing percise

Have a nice day :)


27/03-24 14:18