I had also this problem with many different filename-schemas from different cameras…
So i wrote a bunch of scripts to rename ALL files in one name-scheme, set the artist, move the files from the upload-folder to a filestructure by year and month “YYYY/YYYY_MM”
I run nextcloud AIO so this must be handled inside and outside the container.
The scripts use inotifywait (it works much better then incrond!!!) on the filesystem on the docker host, where the nextcloud-data is stored.
It waits for filesystem-changes and decides what has to be done.
one script (exif-fixdatetime) is looking in exif-data if there is a valid date/time set. If not, it looks in the filename if it can extract a valid date/time for the image.
Then it renames the file to a namescheme YYYYMMDD_HHMMSS. and moves it to the Folder YYYY/YYYY_MM
If there a file exists with the same filename, it adds -1 or -2 (depending on the last existing) to the filename (it’s a feature of exiftool)
So i have 2 inotifywait-watchers . One for the Upload-Folder in Nextcloud, and one for the rest.
The watcher in the uploadfolder takes each uploaded file, puts it into a batch-job and run the exif-fixdatetime script. batch runs the script only if the load of the computer is less than 0.5 So if you upload a big amount of images in a bunch, the server stays still responsive.
The other watcher for the rest of the filesystem takes filesystem-changes and writes the path of the directory or the file in a “stack” file. Because Changes of one file can lead to many filesystem-change-operations…
Or sometimes you change a file more than one time in a short timespan…
If each change leads directly to a rescan of nextcloud files, your server will become unresponsive… that’s not good.
So i collect all changed files and directories in a stack. And a cronjob takes every minute or 2 the stack sorts and uniqs the entries and do a selective occ files:scan (even with directories and groupfolders as well!!!) only for the changed files or directories, and when needed also recursive.
Fazit:
You define an Upload-Folder (in german nextcloud-installations it’s called per default SofortUpload) and all your Uploads (Camera, Whatsapp, Signal…) you want to have processed like this, go into this folder (and as well subfolders!!!)
You take a photo or receive an image on Whatsapp, the nextcloud app uploads it to the nextcloud. Wait a Minute or 2, and you can see your Images in a shell-sortable namescheme in a resulting folder-structure by YYYY/YYYY_MM rescaned by nextcloud, so your images appear in the correct timeline in memories too.

If collect my bunch of scripts here in my git
You can modify this scripts to be run on a bare-metal installation (without docker) as well.
But you have to be admin with root-access to the server on your instance of nextcloud to run this.
If you have questions, feel free and ask.
Regards
Jakob