Organized folder structure (with fallback options if no EXIF data present)

Started by directory3, April 22, 2021, 02:33:21 AM

Previous topic - Next topic

directory3

Spent Saturday, Sunday and today searching forums here, but I have a unique options and cannot figure it out.

I have multiple recurring folders on my PC from mobile device images/videos (mostly JPG, JPEG, MP4, 3G2, etc). Ideally I would like to parse all data in a single command. But I could split into images, then videos.

Would like exiftool to COPY source files into new dest folder structure [\YYYY\YYYY-MM-DD]. No changes to files or renaming, just copy to new folder structure.

I think it makes sense to have exiftool to parse the EXIF for each file as follows:

  • EXIF:DateTimeOriginal -- if no value, try
  • EXIF:CreateDate -- if no value, try
  • FILE:FileName -- extract the date from the filename (this one might be tricky to parse), and move into a different folder structure [\CheckMe\YYYY\YYYY-MM-DD] so that I can manually investigate further.
  • FILE:FileModifyDate -- and move into a different folder structure [\CheckMe\YYYY\YYYY-MM-DD] so that I can manually investigate further.

If there's a file conflict (duplicates), kick it to the "CheckMe" folder.

I put a lot of thought into this, I wonder if this is a "best practice" scenario.

Appreciate any insights, or code, please?

Phil Harvey

Kicking the duplicates to a CheckMe folder is difficult.  Also, I would need to know the date/time formatting of the filename to be able to extract the date/time from it.  Basically, the command could be something like this:

eiftool "-directory<CheckMe/$filemodifydate" "-directory<CheckMe/${filename;EXTRACT_DATETIME_FROM_FILENAME_SOMEHOW}" "-directory<createdate" "-directory<datetimeoriginal" "-filename<%f%-.8c.%e" -o . -d %Y/%Y-%m-%d DIR

Here I have added an 8-digit copy number to names of the duplicate files.  It should be fairly easy to search for files with this number added, and deal with these separately.

Note that this will only copy files that are "writable" by ExifTool.  eg. It won't deal with AVI or WAV files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

My thought was to just let duplicates fail to copy.  Anything left over would be a duplicate and could be moved to the Check Me folder, either by a second exiftool pass or some other way.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Quote from: StarGeek on April 22, 2021, 10:27:30 AM
My thought was to just let duplicates fail to copy.  Anything left over would be a duplicate and could be moved to the Check Me folder, either by a second exiftool pass or some other way.

...but all files are left behind since they are being copied.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

directory3

Thank you Phil! I'm making a backup (!) and will try this tonight :)