Skip to content

Instantly share code, notes, and snippets.

@m-wild
Created April 11, 2020 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-wild/d56c0b1fe2937eb60c8a555ca254b226 to your computer and use it in GitHub Desktop.
Save m-wild/d56c0b1fe2937eb60c8a555ca254b226 to your computer and use it in GitHub Desktop.
Using exiftool to fix dates
ls `
| select -property @{Name='DateTimeOriginal'; Expression={(exiftool -datetimeoriginal $_).substring(34)}}, fullname `
| where {$_.DateTimeOriginal -like '2017*'} `
| %{& exiftool -datetimeoriginal="$_.DateTimeOriginal.Replace('2017','2018')" $_.fullname}
ls | select-object -property @{Name='DateTimeOriginal'; Expression={(exiftool -datetimeoriginal $_)}}, fullname | where {$_.DateTimeOriginal -like '*2017*'} | %{& exiftool -AllDates"+=1:0:0 0" $_.fullname}
ls | where {$_.name -notlike '*_original'} | select-object -property @{Name='DateTimeOriginal'; Expression={(exiftool -datetimeoriginal $_)}}, fullname | where {$_.DateTimeOriginal -like '*2017*'} | %{& exiftool -AllDates"+=1:0:0 0" $_.fullname}
ls | where {$_.name -notlike '*_original'} | select-object -property @{Name='DateTimeOriginal'; Expression={(exiftool -datetimeoriginal $_)}}, fullname | where {$_.DateTimeOriginal -like '*2017*'} | %{& exiftool -datetimeoriginal"+=1:0:0 0" -createdate"+=1:0:0 0" -modifydate"+=1:0:0 0" $_.fullname}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment