Created
June 25, 2012 09:30
-
-
Save 573/2987621 to your computer and use it in GitHub Desktop.
Renames *.jpg files according to shooting time data (EXIF)
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 characters
@ECHO OFF | |
:: Taken from section "Processing Single Line Output" (http://www.imagemagick.org/Usage/windows/#single) | |
:: You need to set PATH=h:\ImageMagick-XXX-Q16-windows;%PATH% first | |
:: This script, when run in a directory of *.jpg files does the following for each of them: | |
:: Prints the file name | |
:: Retrieves EXIF data about original shooting time digitized down to partials of seconds | |
:: (for continuous shootings) and renames the file according to that data, not asking if | |
:: a file of that new name already exists (DANGEROUS, use move /-Y to ask each time). | |
FOR %%a in (*.jpg) DO ( | |
ECHO Processing file: "%%~nxa" | |
:: identify -ping -format "%%[EXIF:DateTimeOriginal] %%[EXIF:SubSecTimeDigitized]" %%~nxa | |
FOR /F "tokens=1,2,3,4,5,6,7,* delims=: " %%i IN ( | |
'identify -ping -format "%%[EXIF:DateTimeOriginal] %%[EXIF:SubSecTimeDigitized]" %%~nxa' | |
) DO move /Y "%%~dpnxa" "%%~dpa%%i-%%j-%%k--%%l.%%m.%%n,%%o%%~xa") | |
) | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment