- Bash version 4 or newer
- Nextcloud Photos app
- Over all enabled users, take all first level directories inside /Photos, which are not hidden
- For each found directory:
-
Check if a file named .noimage, .noindex, .nomedia or .nomemories is in the directory, skip if this is the case
-
Get the info about the last script-run or "0" as fallback
-
Find multimedia files (images, videos) which are created or modified since last script-run and are not hidden and not in hidden subdirectories. Visible subdirectories will be processed too, even with an ignore-file!
If no multimedia file found, process next directory
-
Before processing first file:
- Execute files:scan on directory to be sure all files are known to nextcloud
- Photo album will be created, named by directory
-
All multimedia files found in the directory will be added to this album.
-
Timestamp when the directory was processed will be stored in user:setting directory2album "album_indexed_datetimes"
-
- You can set up the directory where your directory-organized photos/videos are. Default: Photos
- In the function get_album_name_from_path you can tune your album names. Default: basename of the directory without | and : because that are reserved characters.
Copy this script into apps/directory2album directory in your nextcloud instance and make it executable.
- Test the script in your test environment first.
- Run the script every time you added multimedia files to your directories. Can be executed frequently by a cronjob.
Autor: Michael Deichen https://github.com/mide22
License: GPL v3