I use Nextclouds image upload feature to backup all photos from my phone. I recently discovered that you could upload pictures from your phone into subfolders in the
After switching this feature on, I realized that all my previously uploaded 3000+ images and short videos lie flat in the Pictures folder. I needed a solution to organize all existing photos into the same subfolder structure.
I was thinking about writing a shell script and using ExifTool to read the EXIF metadata and move the pictures into their respective folder location based on their creation date. After checking the ExifTool documentation, I found out that ExifTool itself can help with this task. No need to write a script unless you need something very, very special.
This is what I used to reorganize all pictures files into their respective subfolders:
exiftool -d %Y/%m/%d "-directory<filemodifydate" "-directory<createdate" "-directory<datetimeoriginal" .
This one-liner will inspect all files in the current directory (.), examine the
datetimeoriginal exif tags in that order to determine the needed information to move the file into a subdirectory that will match the year (%Y), month (%m) and day (%d).