How to shift time based on the previous/next folder going though several folders

Started by mesqueeb, September 03, 2018, 02:28:39 AM

Previous topic - Next topic

mesqueeb

So I have about 10,000 photos divided in a lot of folders.

Each folder has only photos of no more than 1 day, however, several folders can have pictures of the same day.

Each folder has the photos in order based on the time starting at 18:00 ending at 20:00 or so.

In the case folder [A] has photos of the same day as folder , both of the folders photos are ordered with the time stamp starting at 18:00, incrementing a few min/sec until around 20:00 or so.

I want to:


  • Go through each folder
  • Check if the first photo in the previous folder (eg. folder A) is the same date or not.


    • If it's a different date - do nothing
    • If it's the same date (eg. folder A's first photo date == folder B's first photo date) then go to the next step
  • Target the photos in folder B in the order from earliest date until latest date
  • For each of these photos set just the timestamp to increment 1 min per photo and start from the timestamp of the photo with the latest date in the previous folder

→ all above mentions of "date" and "time" refer to `MDItemFSCreationDate` and `AllDates` which are synced for all of these 4 tags.

Now I'm used to doing small stuff with exiftool, but not something like this, so I'd love some advice!

I know you can change just the part of the photo's timestamp or just the part of the date with perl regular expressions like so:

exiftool /Users/test/photos '-MDItemFSCreationDate<${MDItemFSCreationDate;s/ .*//} ${MDItemFSContentChangeDate;s/.* //}' '-AllDates<${MDItemFSCreationDate;s/ .*//} ${MDItemFSContentChangeDate;s/.* //}' -r


But I'm not sure how to retrieve values of photos in previous folders etc.

I'm a JavaScript developer, so go easy on me : )

Phil Harvey

Unfortunately, ExifTool is file based, not folder based.  So you can't evaluate a condition based on the first photo in a folder.  You would need to do this with some other type of script (batch file, shell script, php, perl, python, etc).

- 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 ($).