Move photo uploads to the folder [Year]/[Month Number]_[Month Name]

Hello everyone,

I have a local Nextcloud instance: Nextcloud Hub 25 Autumn (32.0.6), which I installed on a Univention (UCS) 5.2 via the App Center. This was installed as a Docker container.However, the actual data is stored on a different UCS (Directory Manager) and is integrated into Nextcloud for users as external storage (CIFS). So the data is not stored directly on the Nextcloud instance. On the file server (Samba-AD), there is a share named “Photos” which, as mentioned, is integrated for the user “tom” in the Nextcloud web UI. That works fine.

I’ve connected my Android 16 / GrapheneOS device using the Nextcloud app and can see all the shares there. Furthermore, I have set up auto-upload in the app: DCIM/Camera → Photos/tom Newly taken photos automatically end up in the Photos/tom directory. I am looking for a way to automatically move them into an appropriate directory structure. The images should be placed in the appropriate folder based on their EXIF header (creation date):

[Year]/[Month Number]_[Month Name]

It needs to be moved, or if it doesn’t exist, it should be created. I spent the whole day trying to solve the problem by searching online, but unfortunately I wasn’t able to do so.

I found out that I first need to tag the files. To do this, I installed “Files Automated Tagging” and created a rule that matches the filename /^IMG_.*.jpg$/ → Tag: photos_by_date

I did that as the user “tom” in the WebUI, not as an administrator. I’m not sure if that’s correct. I thought it was because the user “Administrator” hadn’t mounted the CIFS share.

The tag is also set correctly.

I also read that I need the “Workflow external scripts” app, which I’ve already installed. However, I’m stuck here. Logged in as an administrator: Administrator Settings → Workflow (under Administration), I can define rules:

If: Keyword assignedAnd: Collaborative tag on file → is tagged with: photos_by_dateBut he wants a script as the action. What language can I use here? Bash? I guess I have to create the script in the container’s filesystem? I found some paths in the forum where it should go (/var/nextcloud/.scripts). This path doesn’t exist on my UCS. How do I figure out where I need to save the script?

Does the script even work with externally mounted storage like CIFS?

with best

the nc-app itself should do that at least for all newly taken pictures while uploading them.
there’s a checkbox for that in setup

Yes, but this option creates the folder for the month using only the month number, e.g., “03,” instead of “03_March.” Is there any way to change this?

not that I know of. But maybe you can program something yourself?

Which brings us back to my original question. I’ve organized my entire photo collection according to the structure mentioned above. I didn’t do this manually; instead, I wrote a script that reads the EXIF header—specifically the creation date stored there—and then sorts the images according to that structure.

This raises two questions for me:

1.) Where should I save the script in the Docker container, or how do I find out where it’s supposed to be?

2.) Does the script work even if the files are located on a CIFS share? This was mentioned in some posts.