Conditional Renaming Images Files

Advanced Renamer forum
#1 : 12/04-24 21:53
Thales Martins
Posts: 1
Hi,
I'm having a problem that needs help.
I renamed my files to get the <Img DateOriginal:yyyy-mm-dd> on most of my files, but many don't have this Exif info. Still, they are located in a directory named after the image's creation date (for example, 2011-05-24).
On all files that don't have the "DateOriginal" from Exif, I want to precede the name with the directory name in the actual form (YYYY-MM-DD).

For example:
Files that have the "DateOriginal" from Exif" will be "2011-05-24 - Image name.jpg"
Files that don't have the "DateOriginal" from Exif" will be YYYY-MM-DD - Image name.jpg" , where YYYY-MM-DD is the directory name where the file is located.

From the documentation, it looks like this can be accomplished with Javascript, but I am not familiar with this, and I need help from someone who could provide me with the code to add to the Renaming method list for me to add in a script and execute it on my 18000 files.
Thank you in advance for this help or any idea on how to solve this problem.
#2 : 12/04-24 23:15
Delta Foxtrot
Posts: 324
Reply to #1:

Hello Thales, welcome!

If I understand your question you just want to add the parent folder name at the start of all filenames that don't already start with "YYYY-MM-DD - ". You don't need javascript for that.

Use a new name method on all the files (if it's only 18,000 you can do them all at once, though I'd start with a few hundred as a test).

1. Select the required directories and drag them into the ARen files list area. (You'll get the standard selection message box)
2. Select "Add the files in the folders"
3. Tick the "Include subfolders" box
4. In the "Regular expression match:" text box enter "^\d\d\d\d\-\d\d-\d\d \- " (without the quotation marks)
5 Tick the "Not matching" box
6. Click OK

You should see only the files without the date. We'll use a New Name method to replace the old name with the foldername (date) + the old name.

In a New Name method on the method list, enter:
New Name: "<FolderName:1> - <Name>" (without the quotation marks)
Apply to: Name

In the "New filename" column you should see what you need. If not you may need to adjust your new name specification, or check that you've done the process correctly.

Feel good! :)

Best,
DF

https://drive.google.com/file/d/1YbT6lUcexavixuS PLZgwvTo_ulrMlx7H/view?usp=sharing
https://drive.google.com/file/d/1S6harKjDUx__VpA Chi8JWTtc3cAKusgw/view?usp=sharing