How to automatically name photos with dates based on their EXIF ​​information?

How to automatically name photos with dates based on their EXIF ​​information?

Hi, Guys,
I have an autorename app question, I don’t know how to auto rename base on picture EXIF info. Does any one can make a sameple a .rename.conf file for me? I was make a confn file on each folder like as below, but it doesn’t work for me.

I hope all of my JPG files renmae as below format.
2012-05-11 19.35.02.jpg
YYYY-MM-DD HH.MM.SS

my .rename.conf content
^(?!\d{2}-\d{2}-\d{2}(\s|_)\d{2}-\d{2}-\d{2}).*.(jpg|JPG|jpeg)$:{exifDateTimeOriginal|y-m-d H-i-s} $0

Hi, does this help? What should I do if a file is not renamed but I expect it to be renamed?

Deer Powerflo,
i know this page, so i do as them, but something i may not follow up, so it is not work for me. so could you make a .rename.conf file for me? i put it in the folder. Thanks.

Your .rename.conf with the rule

^(?!\d{2}-\d{2}-\d{2}(\s|_)\d{2}-\d{2}-\d{2}).*.(jpg|JPG|jpeg)$:{exifDateTimeOriginal|y-m-d H-i-s} $0

is a valid rule and should rename an uploaded or moved photo asdf.jpg with exif data to something like 17-11-28 19-22-24 asdf.jpg. If the photo has no exif data then asdf.jpg.

If that does not work, set the log level to debug, upload or move a photo in the folder with the rule and post the logs here. Then I can help investigate. The log entries filtered by “autorename” should look something like that:

Sir,
Thanks a lot for your help. I’m not sure which part is problematic since I don’t know where to find the log loader you attached, so I’m first focusing on whether the command is correct and how to get the logs.

i try to modify the command via grok v3, i plan change all of jpg filename to date_name. do you think this is correct? Thanks.

^(?!\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}(?:-\d+)?.(jpg|JPG|jpeg)$)\w+.(jpg|JPG|jpeg)$:{exif:exifDateTimeOriginal|format|Y-m-d_H.i.s}.{ext}

As I said: the rule from your initial post is correct. The rule from grok is wrong.

The AutoRename app does not rename existing files: Will existing files be renamed after I create or update a .rename.conf file?.
To rename existing files move them out and then back into the folder. Then the rules are applied.

1 Like

The log reader is in Administration Settings > Logging or https://your-nextcloud-url/settings/admin/logging

There you can set the debug level and filter entries.

1 Like

Thanks your quick reply, i am appreciate.
After I upload some pics via WebUI, i got some log like as below, but their name doesn’t autorename.

background job setting

I guess the autorename app is working, but my .conf file setuping is wrong.
attached is file name list.

attached are picture’s EXIF info.

my .rename.conf
^(?!\d{2}-\d{2}-\d{2}(\s|_)\d{2}-\d{2}-\d{2}).*.(jpg|JPG|jpeg)$:{exifDateTimeOriginal|y-m-d H-i-s} $0

so could you kindly help me to modfiy the setting file?
my request is rename any .jpg, .JPG, .jpeg file to photoDateTime|format or exifDateTimeOriginal|format

for example:
A: (no_EXIF info, but have file time)
A123.jpg change name to → 2024-02-05 13.30.55.jpg

B:(have EXIF info)
asdasd3.jpg change name to ->2024-02-05 13.30.55.jpg

Your .rename.conf file is correct, as the logs show that the pattern matches the file name and a new name is generated.
The actual renaming happens in a background job a few minutes later. There should be a log message “RenameJob running”, followed by additional log entries.

However, the root cause might lie in the log message from the Photos app: “EXIF entry ignored as it is too large.”

As a result, the {exifDateTimeOriginal} placeholder is empty, and the rule ends up adding only a space at the beginning of the file name. The file is renamed, but unfortunately, the leading space is not visible in the file list. In the logs, the space is only visible if you click “Show details” on the log message. However, in the Activity app, you should see that the file was renamed.

If you’d like to use the file modification time as a fallback when no EXIF datetime exists, use the photoDateTime placeholder instead:

^(?!\d{2}-\d{2}-\d{2}(\s|_)\d{2}-\d{2}-\d{2}).*\.(jpg|JPG|jpeg)$:{photoDateTime|y-m-d H-i-s} $0
1 Like

I was testing with this setup but one of the images still showed the EXIF ​​entries being ignored, attached below. In any case, the names of both photos did not change after a few minutes. My phone’s model name is MI 10T pro for you reference.

I’m not sure whether the ignored EXIF entry is DateTimeOriginal or another EXIF tag.
So I’ve just released v2.1.1, which includes improved debug logging for the exifDateTimeOriginal and photoDateTimeplaceholders.

Since the actual renaming happens in the background job, set the log level to debug, and then look for AutoRename log messages following “RenameJob running”. That might help clarify what’s going on.

After update to 2.1.1,
i got the info as below for two pic.

first one,

second,

some info u might need to know.
1.Does this app need to be run with administrator privileges? Because I uploaded the image through the user account, but checked the log in Admin account in WebUI.
2.My computer is Windows 11, I put the images into a Windows folder that is synced with nextcloud internally.
3.My Nextcould run in UNRAID’s docker mode.


The screenshots of the logs you shared always show the “Adding RenameJob” message, but not the start of the background job where the actual renaming happens. In the logs, there should be something like “RenameJob running”.

You’ve configured background jobs to run with the AJAX option. This method is rather unreliable and not recommended. I tested it myself—it took about 4 minutes of continuously refreshing the page before the AutoRename background job started and the file was finally renamed.

I recommend using cron for background jobs instead. I’m not familiar with Unraid specifically, but I found this post that might help setting it up using the “User Scripts” plugin: https://forums.unraid.net/topic/88504-support-knex666-nextcloud/#comment-822737