-
-
Save dnozay/955037f077b6dec87aa9b1eb552caf8d to your computer and use it in GitHub Desktop.
Revisions
-
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 10 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -129,18 +129,7 @@ The command alone will put the *full* filename in the comments. If you want to a ### Change JPG to jpg and MOV to mov in filenames Learn more about `-filename` and `-directory` on the [exiftool docs][filename]. exiftool '-filename=%f.%le' -ext jpg -ext mov * @@ -297,9 +286,10 @@ To tag all my ULM pictures with coordinates `-21.152441, 55.279274`. - Manual: [exiftool manual][manual] - FAQ: [exiftool FAQ][faq] - Config: [exiftool docs][config] - Filename: [exiftool docs][filename] - Geotagging: [exiftool docs][geotagging] - Timeshift: [exiftool docs][timeshift] ## Update Notes @@ -311,11 +301,12 @@ To tag all my ULM pictures with coordinates `-21.152441, 55.279274`. - 2014-12-25 - Added line for copying photos into organized photos. [config]: http://www.sno.phy.queensu.ca/~phil/exiftool/config.html [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command [faq]: https://sno.phy.queensu.ca/~phil/exiftool/faq.html [filename]: https://sno.phy.queensu.ca/~phil/exiftool/filename.html [geotagging]: http://www.sno.phy.queensu.ca/~phil/exiftool/geotag.html [manual]: https://sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html [millisec]: http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 [quicktime]: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/QuickTime.html [timeshift]: http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ Cheatsheet for image / video metadata manipulation. *Last updated 2019-07-24* ## Disclaimer until more specific license... -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,8 @@ Cheatsheet for image / video metadata manipulation. until more specific license... ``` THE CONTENT BELOW IS PROVIDED "AS-IS", WE DISCLAIM LIABILITY FOR ALL USES TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW. WE MAKE NO GUARANTEES. ``` In other words, don't be dumb, backup your data and don't blame us for losing your precious data. -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 66 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,14 @@ Cheatsheet for image / video metadata manipulation. ## Disclaimer until more specific license... ``` THE CONTENT BELOW IS PROVIDED "AS-IS", WE DISCLAIM LIABILITY FOR ALL USES TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW. WE MAKE NO GUARANTEES. ``` In other words, don't be dumb, backup your data and don't blame us for losing your precious data. ## Important options -h ➔ the most important of all, this cheatsheet is not exhaustive. @@ -161,12 +170,63 @@ Info at [Time Shift][timeshift] exiftool "-AllDates+=1:0:0 0" . ### Fix timestamps Because `exiftool` copies files before renaming them to overwrite your files, you want to get this part right. Otherwise you may end up processing GBs of data multiple times. exiftool \ -overwrite_original \ -if '$createdate lt "2013:05:01 00:00:00"' \ '-quicktime:createdate+=1:0:16 11:40:0' \ '-QuickTime:ModifyDate<$createdate' \ '-QuickTime:TrackCreateDate<$createdate' \ '-QuickTime:TrackModifyDate<$createdate' \ '-QuickTime:MediaCreateDate<$createdate' \ '-QuickTime:MediaModifyDate<$createdate' \ -ext mp4 \ . exiftool \ -overwrite_original \ -if '$DateTimeOriginal lt "2013:05:01 00:00:00"' \ '-exif:DateTimeOriginal+=1:0:16 11:40:0' \ '-AllDates+=1:0:16 11:40:0' \ -ext jpg \ . ### Rename files to datestamp *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . Examples exiftool \ '-filename<${DateTimeOriginal}%.3c.jpg' \ -d %y%m%d_%H%M%S \ -if '$datetimeoriginal' \ -ext jpg -ext jpeg \ . exiftool \ '-filename<${DateTimeOriginal}_somelabel_%.3c.jpg' \ -d %y%m%d_%H%M%S \ -if '$datetimeoriginal' \ -ext jpg -ext jpeg \ . for quicktime videos (see [quicktime ref][quicktime]) exiftool \ '-filename<${quicktime:createdate}%.3c%.le' \ -d %y%m%d_%H%M%S \ -if '${quicktime:createdate}' \ -ext mov -ext avi -ext mp4 \ . ### Rename Files to With Milliseconds *Good for burst photos where the seconds are all the same. If milliseconds are only out to 2 digits, use `${SubSecCreateDate}` instead* @@ -232,6 +292,8 @@ To tag all my ULM pictures with coordinates `-21.152441, 55.279274`. ## References - Manual: [exiftool manual][manual] - FAQ: [exiftool FAQ][faq] - Timeshift: [exiftool docs][timeshift] - Geotagging: [exiftool docs][geotagging] - Config: [exiftool docs][config] @@ -250,4 +312,7 @@ To tag all my ULM pictures with coordinates `-21.152441, 55.279274`. [config]: http://www.sno.phy.queensu.ca/~phil/exiftool/config.html [timeshift]: http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html [millisec]: http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 [geotagging]: http://www.sno.phy.queensu.ca/~phil/exiftool/geotag.html [faq]: https://sno.phy.queensu.ca/~phil/exiftool/faq.html [quicktime]: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/QuickTime.html [manual]: https://sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 119 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,81 @@ Cheatsheet for image / video metadata manipulation. ## Important options -h ➔ the most important of all, this cheatsheet is not exhaustive. -s ➔ use tag names instead of description, good for scripting since you want to use [-tagname] options. -G ➔ add group names to each tag, good if you deal with both Exif, XMP, etc. -P ➔ preserve [FileModifyDate], useful if you do not have any timestamp info in the file. Examples $ exiftool -s -G IMG_123.JPG [show all metadata] $ exiftool -AllDates IMG_123.JPG Date/Time Original : 2018:09:14 08:53:41 Create Date : 2018:09:14 08:53:41 Modify Date : 2018:09:14 08:53:41 $ exiftool -AllDates -s IMG_123.JPG DateTimeOriginal : 2018:09:14 08:53:41 CreateDate : 2018:09:14 08:53:41 ModifyDate : 2018:09:14 08:53:41 $ exiftool -DateTimeOriginal -s IMG_123.JPG DateTimeOriginal : 2018:09:14 08:53:41 $ exiftool -exif:DateTimeOriginal -G -s IMG_123.JPG [EXIF] DateTimeOriginal : 2018:09:14 08:53:41 $ exiftool -xmp:DateTimeOriginal -G -s IMG_123.JPG [nothing to see] ## Reading metadata ### Checking timestamps exiftool -time:all -s . exiftool -AllDates -s . ## Searching for Files This is often made more simple with conditions. If you need more advanced comparisons, learn `Perl`. ### Find files with a `jpg` or `jpeg` extension -ext jpg -ext jpeg ### Find files without a `DateTimeOriginal` -if '(not $datetimeoriginal)' Or more specifically in a particular group -if '(not ${exif:datetimeoriginal})' Example $ exiftool -s -G -filename -if '(${exif:datetimeoriginal})' -ext jpg IMG_* ======== IMG_123.JPG [File] FileName : IMG_123.JPG ======== IMG_2131.jpg [File] FileName : IMG_2131.jpg 2 image files read ### Find files invalid `DateTimeOriginal` Often enough, my battery is dead, and I put new ones in, but I forget to set the time on the camera. -if '$DateTimeOriginal lt "2013:05:01 00:00:00"' ### Find files that aren't named properly I like to use ISO date in the filename. -if '$filename !~ /^\d/' ### Output photos that don't have datetimeoriginal to a CSV @@ -46,11 +117,29 @@ The command alone will put the *full* filename in the comments. If you want to a ### Change JPG to jpg and MOV to mov in filenames for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done for i in *.MOV; do mv "$i" "${i%%.MOV}.mov"; done or with bash skills for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done; !#:gs/JPG/MOV/:gs/jpg/mov/ or alternatively with exiftool exiftool '-filename=%f.%le' -ext jpg -ext mov * example, using `-testname` instead to play pretend. $ exiftool '-testname=%f.%le' IMG_* 'IMG_123.JPG' --> 'IMG_123.jpg' Warning: File name is unchanged - IMG_2131.jpg Warning: File name is unchanged - IMG_2132.jpeg 0 image files updated 3 image files unchanged ### Change last created and modified for files in a directory @@ -88,7 +177,10 @@ Found at [this forum post][millisec]. ### Update any photo that doesn't have DateTimeOriginal to have it based on file modify date exiftool \ '-datetimeoriginal<filemodifydate' \ -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' \ . ### Set DateTimeOriginal to Any Arbitrary Timestamp @@ -98,20 +190,34 @@ Found at [this forum post][millisec]. ### Copy directory recursively into organized folder exiftool \ -o ~/dummy/ \ -if '$filesize# > 300000' \ '-Directory<CreateDate' \ -d "~/Desktop/old_photos2/%Y/%m %B" \ -r "~/Desktop/iPhoto Library/" - `-o ~/dummy` This flag is to copy, not move. The directory is a fallback if the flag isn't available on the given photo. Good if using something like DateTimeOriginal - `-if '$filesize# > 300000'` gets files that are over 300kB. I was parsing an iPhoto library where there were thumbnails. The `#` turns the value to a number. you can use the flag `-n` to turn all values to numbers - `'-Directory<CreateDate'` Create directories based on the CreateDate of the photos - `-d "~/Desktop/old_photos/%Y/%m %B"` Create folders with the given date format. - `-r` Run recursively ## Geotagging To tag all my ULM pictures with coordinates `-21.152441, 55.279274`. exiftool \ -exif:gpslatituderef=-1 \ -exif:gpslatitude=-21.152441 \ -exif:gpslongituderef=1 \ -exif:gpslongitude=55.279274 \ *ULM* ### Create KML from geotagged photos @@ -132,7 +238,7 @@ Found at [this forum post][millisec]. ## Update Notes - 2019-07-24 - added more commands for searching for files, fix title formatting, geotagging example - 2017-03-18 - added command to create comments from a filename - 2015-08-11 - added line to rename files based on milliseconds - 2015-01-18 - added line on how to set a date for a particular photo(s) -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,6 +124,11 @@ Found at [this forum post][millisec]. exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv ## References - Timeshift: [exiftool docs][timeshift] - Geotagging: [exiftool docs][geotagging] - Config: [exiftool docs][config] ## Update Notes @@ -138,4 +143,5 @@ Found at [this forum post][millisec]. [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command [config]: http://www.sno.phy.queensu.ca/~phil/exiftool/config.html [timeshift]: http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html [millisec]: http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 [geotagging]: http://www.sno.phy.queensu.ca/~phil/exiftool/geotag.html -
dnozay revised this gist
Jul 24, 2019 . 1 changed file with 24 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,13 @@ Cheatsheet for image / video metadata manipulation. ## Searching for Files ### Find images in a directory that don't have a DateTimeOriginal exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . ### Output photos that don't have datetimeoriginal to a CSV *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable @@ -24,13 +25,13 @@ exiftool -q -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' -csv -common "$n" | sed 1d >> "$DROPBOX_PERSONAL/nodates.csv" done < <( mdfind -onlyin "$DROPBOX_PERSONAL" 'kMDItemKind =="JPEG image"' -0 ) ### See files File Modify Date recursively in a directory who don't have datetimeoriginal set exiftool -filemodifydate -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Modifying Files ### Create Captions From a Filename The command alone will put the *full* filename in the comments. If you want to add the filename without the extension, add the example exiftool config file found [here][config] @@ -43,15 +44,15 @@ The command alone will put the *full* filename in the comments. If you want to a exiftool "-Comment=$FileName" "-UserComment=$FileName" "$i"; done ### Change JPG to jpg and MOV to mov in filenames for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done; !#:gs/JPG/MOV/:gs/jpg/mov/ Recursively find /path/to/directory -name *JPG -exec sh -c 'mv "$0" "${0%%.JPG}.jpg"; echo "Moved $0 to ${0%%.JPG}.jpg"' {} \; ### Change last created and modified for files in a directory *The date syntax has to be YYYY:MM:DD HH:MM:SS* @@ -65,37 +66,37 @@ Option 2: exiftool "-AllDates=1986:11:05 12:00:00" -if '$filetype eq "JPEG"' . ### Timeshift Photos by One Year Info at [Time Shift][timeshift] exiftool "-AllDates+=1:0:0 0" . ### Rename files to datestamp *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . ### Rename Files to With Milliseconds *Good for burst photos where the seconds are all the same. If milliseconds are only out to 2 digits, use `${SubSecCreateDate}` instead* Found at [this forum post][millisec]. exiftool -v '-Filename<${datetimeoriginal}${subsectimeoriginal;$_.=0 x(3-length)}.%e' -d %Y%m%d_%H%M%S . ### Update any photo that doesn't have DateTimeOriginal to have it based on file modify date exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ### Set DateTimeOriginal to Any Arbitrary Timestamp exiftool '-datetimeoriginal=2015:01:18 12:00:00' . ## Moving/Copying Files ### Copy directory recursively into organized folder exiftool -o ~/dummy/ -if '$filesize# > 300000' '-Directory<CreateDate' -d ~/Desktop/old_photos2/%Y/%m\ %B -r ~/Desktop/iPhoto\ Library/ @@ -112,20 +113,21 @@ Found at http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 ## Extras ### Create KML from geotagged photos DESKTOP=$HOME/Desktop cat $DESKTOP/kml-start.fmt > out.kml exiftool -n -r -q -p $DESKTOP/kml-placemark.fmt . >> out.kml cat $DESKTOP/kml-end.fmt >> out.kml ### Create CSV of Geo Information exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv ## Update Notes - 2019-07-24 - fix title formatting - 2017-03-18 - added command to create comments from a filename - 2015-08-11 - added line to rename files based on milliseconds - 2015-01-18 - added line on how to set a date for a particular photo(s) @@ -134,4 +136,6 @@ Found at http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command [config]: http://www.sno.phy.queensu.ca/~phil/exiftool/config.html [timeshift]: http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html [millisec]: http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 -
rjames86 revised this gist
Mar 18, 2017 . 1 changed file with 17 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ *Last updated: 2017-03-18* ## Searching for Files @@ -30,6 +30,19 @@ ## Modifying Files ### Create Captions From a Filename ### The command alone will put the *full* filename in the comments. If you want to add the filename without the extension, add the example exiftool config file found [here][config] # This is the command if you have the config installed exiftool '-Comment<BaseName' '-UserComment<BaseName' . # Getting the filename without the config file, but with a for-loop for i in *; do FileName="${i%%.*}" exiftool "-Comment=$FileName" "-UserComment=$FileName" "$i"; done ###Change JPG to jpg and MOV to mov in filenames### for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done; !#:gs/JPG/MOV/:gs/jpg/mov/ @@ -113,10 +126,12 @@ Found at http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 ## Update Notes ## - 2017-03-18 - added command to create comments from a filename - 2015-08-11 - added line to rename files based on milliseconds - 2015-01-18 - added line on how to set a date for a particular photo(s) - 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] - 2014-12-25 - Added line for copying photos into organized photos. [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command [config]: http://www.sno.phy.queensu.ca/~phil/exiftool/config.html -
Ryan M revised this gist
Aug 11, 2015 . 1 changed file with 15 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ *Last updated: 2015-08-11* ## Searching for Files ### Find images in a directory that don't have a DateTimeOriginal ### exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . @@ -24,7 +24,7 @@ exiftool -q -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' -csv -common "$n" | sed 1d >> "$DROPBOX_PERSONAL/nodates.csv" done < <( mdfind -onlyin "$DROPBOX_PERSONAL" 'kMDItemKind =="JPEG image"' -0 ) ### See files File Modify Date recursively in a directory who don't have datetimeoriginal set ### exiftool -filemodifydate -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . @@ -58,13 +58,21 @@ Info at http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html exiftool "-AllDates+=1:0:0 0" . ### Rename files to datestamp ### *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . ### Rename Files to With Milliseconds ### *Good for burst photos where the seconds are all the same. If milliseconds are only out to 2 digits, use `${SubSecCreateDate}` instead* Found at http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=2736.0 exiftool -v '-Filename<${datetimeoriginal}${subsectimeoriginal;$_.=0 x(3-length)}.%e' -d %Y%m%d_%H%M%S . ### Update any photo that doesn't have DateTimeOriginal to have it based on file modify date ### exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . @@ -98,13 +106,14 @@ Info at http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html exiftool -n -r -q -p $DESKTOP/kml-placemark.fmt . >> out.kml cat $DESKTOP/kml-end.fmt >> out.kml ### Create CSV of Geo Information ### exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv ## Update Notes ## - 2015-08-11 - added line to rename files based on milliseconds - 2015-01-18 - added line on how to set a date for a particular photo(s) - 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] - 2014-12-25 - Added line for copying photos into organized photos. -
Ryan M revised this gist
Jan 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ Option 2: Info at http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html exiftool "-AllDates+=1:0:0 0" . ###Rename files to datestamp### -
Ryan M revised this gist
Jan 25, 2015 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ [exec_sh] m*Last updated: 2015-01-18* ## Searching for Files @@ -52,6 +52,12 @@ Option 2: exiftool "-AllDates=1986:11:05 12:00:00" -if '$filetype eq "JPEG"' . ### Timeshift Photos by One Year ### Info at http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html exiftool "-datecreated+=1:0:0 0" . ###Rename files to datestamp### *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* -
Ryan M revised this gist
Jan 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . ###Output photos that don't have datetimeoriginal to a CSV### *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable -
Ryan M revised this gist
Jan 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . ###Output photos that don't have datetimeoriginal to a CSV### *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable -
Ryan M revised this gist
Jan 19, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ *Last updated: 2015-01-18* ## Searching for Files @@ -99,6 +99,7 @@ Option 2: ## Update Notes ## - 2015-01-18 - added line on how to set a date for a particular photo(s) - 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] - 2014-12-25 - Added line for copying photos into organized photos. -
Ryan M revised this gist
Jan 19, 2015 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . ###Output photos that don't have datetimeoriginal to a CSV ### *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable @@ -58,10 +58,14 @@ Option 2: exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . ### Update any photo that doesn't have DateTimeOriginal to have it based on file modify date### exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ### Set DateTimeOriginal to Any Arbitrary Timestamp ### exiftool '-datetimeoriginal=2015:01:18 12:00:00' . ## Moving/Copying Files ## ###Copy directory recursively into organized folder### -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,8 +95,8 @@ Option 2: ## Update Notes ## - 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] - 2014-12-25 - Added line for copying photos into organized photos. [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,7 +95,7 @@ Option 2: ## Update Notes ## 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] 2014-12-25 - Added line for copying photos into organized photos. -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,5 +95,8 @@ Option 2: ## Update Notes ## 2014-12-26 - Adding new recursive command to rename JPG to jpg. Info on using `sh` with `-exec` [here][exec_sh] 2014-12-25 - Added line for copying photos into organized photos. [exec_sh]: http://unix.stackexchange.com/questions/60404/manipulate-file-name-piped-from-find-command -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 16 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ *Last updated: 2014-12-26* ## Searching for Files ###Find images in a directory that don't have a DateTimeOriginal### exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . ###Output photos that don't have datetimeoriginal to a CSV### *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable @@ -24,17 +24,21 @@ exiftool -q -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' -csv -common "$n" | sed 1d >> "$DROPBOX_PERSONAL/nodates.csv" done < <( mdfind -onlyin "$DROPBOX_PERSONAL" 'kMDItemKind =="JPEG image"' -0 ) ###See files File Modify Date recursively in a directory who don't have datetimeoriginal set### exiftool -filemodifydate -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Modifying Files ###Change JPG to jpg and MOV to mov in filenames### for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done; !#:gs/JPG/MOV/:gs/jpg/mov/ Recursively find /path/to/directory -name *JPG -exec sh -c 'mv "$0" "${0%%.JPG}.jpg"; echo "Moved $0 to ${0%%.JPG}.jpg"' {} \; ###Change last created and modified for files in a directory### *The date syntax has to be YYYY:MM:DD HH:MM:SS* @@ -48,19 +52,19 @@ Option 2: exiftool "-AllDates=1986:11:05 12:00:00" -if '$filetype eq "JPEG"' . ###Rename files to datestamp### *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . ###Update any photo that doesn't have DateTimeOriginal to have it based on file modify date### exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Moving/Copying Files ## ###Copy directory recursively into organized folder### exiftool -o ~/dummy/ -if '$filesize# > 300000' '-Directory<CreateDate' -d ~/Desktop/old_photos2/%Y/%m\ %B -r ~/Desktop/iPhoto\ Library/ @@ -77,18 +81,19 @@ Option 2: ## Extras ###Create KML from geotagged photos### DESKTOP=$HOME/Desktop cat $DESKTOP/kml-start.fmt > out.kml exiftool -n -r -q -p $DESKTOP/kml-placemark.fmt . >> out.kml cat $DESKTOP/kml-end.fmt >> out.kml ###Create CSV of Geo Information### exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv ## Update Notes ## 2014-12-26 - Adding new recursive command to rename JPG to jpg 2014-12-25 - Added line for copying photos into organized photos -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ *Last updated: 2014-12-25* ## Searching for Files @@ -86,4 +86,9 @@ Option 2: **Create CSV of Geo Information** exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv ## Update Notes ## 2014-12-25 - Added line for copying photos into organized photos -
Ryan M revised this gist
Dec 26, 2014 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,6 +58,23 @@ Option 2: exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Moving/Copying Files ## **Copy directory recursively into organized folder** exiftool -o ~/dummy/ -if '$filesize# > 300000' '-Directory<CreateDate' -d ~/Desktop/old_photos2/%Y/%m\ %B -r ~/Desktop/iPhoto\ Library/ `-o ~/dummy` This flag is to copy, not move. The directory is a fallback if the flag isn't available on the given photo. Good if using something like DateTimeOriginal `-if '$filesize# > 300000'` gets files that are over 300kB. I was parsing an iPhoto library where there were thumbnails. The `#` turns the value to a number. you can use the flag `-n` to turn all values to numbers `'-Directory<CreateDate'` Create directories based on the CreateDate of the photos `-d ~/Desktop/old_photos/%Y/%m\ %B` Create folders with the given date format. `-r` Run recursively ## Extras **Create KML from geotagged photos** -
rjames86 revised this gist
Nov 5, 2014 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ *Last updated: 2014-11-04* ## Searching for Files **Find images in a directory that don't have a DateTimeOriginal** @@ -28,7 +28,7 @@ exiftool -filemodifydate -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Modifying Files **Change JPG to jpg and MOV to mov in filenames** @@ -58,13 +58,15 @@ Option 2: exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . ## Extras **Create KML from geotagged photos** DESKTOP=$HOME/Desktop cat $DESKTOP/kml-start.fmt > out.kml exiftool -n -r -q -p $DESKTOP/kml-placemark.fmt . >> out.kml cat $DESKTOP/kml-end.fmt >> out.kml **Create CSV of Geo Information** exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv -
rjames86 revised this gist
Sep 29, 2014 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,5 +57,14 @@ Option 2: **Update any photo that doesn't have DateTimeOriginal to have it based on file modify date** exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . # Extras **Create KML from geotagged photos** DESKTOP=$HOME/Desktop cat $DESKTOP/kml-start.fmt > out.kml exiftool -n -r -q -p $DESKTOP/kml-placemark.fmt . >> out.kml cat $DESKTOP/kml-end.fmt >> out.kml
-
rjames86 revised this gist
Sep 28, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ *Last updated: 2014-09-28* # Searching for Files **Find images in a directory that don't have a DateTimeOriginal** -
rjames86 revised this gist
Sep 28, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,8 @@ **Change last created and modified for files in a directory** *The date syntax has to be YYYY:MM:DD HH:MM:SS* Option 1: find . -name "*.jpg" | while read filename; -
rjames86 revised this gist
Sep 28, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ **Find images in a directory that don't have a DateTimeOriginal** exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . **Output photos that don't have datetimeoriginal to a CSV** *Note this can take a long time if you have a lot of jpgs* -
rjames86 created this gist
Sep 28, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ # Searching for Files **Find images in a directory that don't have a DateTimeOriginal** exiftool -filename -filemodifydate -r -if '(not $datetimeoriginal) and $filemodifydate le "2014:01:01" and $filetype eq "JPEG"' . **Output photos that don't have datetimeoriginal to a CSV** *Note this can take a long time if you have a lot of jpgs* # You'll need to set your Dropbox folder path. I have mine set as a global variable OLDFILE="$DROPBOX_PERSONAL/nodates.csv" FILECOUNT=$(mdfind -count -onlyin "$DROPBOX_PERSONAL" 'kMDItemKind =="JPEG image"') while IFS= read -r -d '' n; do FILECOUNT=$(( $FILECOUNT - 1 )) if grep -q "$n" "$OLDFILE"; then echo "Skipping $n" continue fi echo -ne "Remaining: $FILECOUNT\r" exiftool -q -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' -csv -common "$n" | sed 1d >> "$DROPBOX_PERSONAL/nodates.csv" done < <( mdfind -onlyin "$DROPBOX_PERSONAL" 'kMDItemKind =="JPEG image"' -0 ) **See files File Modify Date recursively in a directory who don't have datetimeoriginal set** exiftool -filemodifydate -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' . # Modifying Files **Change JPG to jpg and MOV to mov in filenames** for i in *.JPG; do mv "$i" "${i%%.JPG}.jpg"; done; !#:gs/JPG/MOV/:gs/jpg/mov/ **Change last created and modified for files in a directory** Option 1: find . -name "*.jpg" | while read filename; exiftool "-AllDates=1986:11:05 12:00:00" "$filename"; done Option 2: exiftool "-AllDates=1986:11:05 12:00:00" -if '$filetype eq "JPEG"' . **Rename files to datestamp** *Filename looks like 2014-01-01 12:00:00.jpg and will append -NUM if DateTimeOriginal is the same for multiple files* exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" . **Update any photo that doesn't have DateTimeOriginal to have it based on file modify date** exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' .