@ echo off rem rem File: lr-datetime-equalize.bat rem rem Description: Microsoft Windows batch file calling exiftool and exiftool arguments file. Process equalizes rem date/time metadata across all relevant JPG, CR2 and XMP file metadata fields. rem rem Purpose: To match all date/time metadata fields to the same date/time value. rem rem Reason: Many photo organizing and editing tools allow the change of one or more date/time rem metadata fields. Doing so leaves the photo file(s) with some date/time fields that rem do not match. Different photo geotagging, organizing and editing tools, as well as rem photo hosting web sites, use different date/time metadata fields to establish rem the date/time for the photo. This can cause many problems related to geolocation, rem photo sorting, photo display order, etc. By equalizing, or matching, the date/time rem information across all metadata date/time fields, the photos will be treated rem processed, displayed, etc. the same by all photo tools and web sites. rem rem rem Usage: 1. Using Windows Explorer or a command line, place this batch file and the rem lr-datetime-equalize.args in the folder/directory with the photos you wish to process rem rem 2. Using Windows Explorer or a command line, execute the batch file. rem -Windows Explorer: double click the lr-datetime-equalize.bat file rem -command line: lr-datetime-equalize.bat rem rem rem Revisions: 2011/07/12 - V1.00 Douglas Hackney created contact: dhackney@egltd.com rem rem rem References: metadata: http://www.metadataworkinggroup.org/specs/ rem http://www.hackneys.com/travel/docs/metadataoverview.pdf rem http://www.hackneys.com/travel/docs/photo-metadata-datetime.xls rem exiftool: http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html rem rem Notes: rem * This batch file processes all xmp, cr2 and jpg files in a directory and its subdirectories. rem rem * This batch file requires the parameter file lr-datetime-equalize.args for data field mapping. rem rem * Put this batch file and the lr-datetime-equalize.args file in the directory with the files you rem wish to process. rem rem * This batch file processes Canon CR2 (RAW) files first, then JPG files. rem rem * If you wish to use this utility for non-Canon RAW files, edit the file name extension CR2 and cr2 rem below to your applicable RAW filetype extension, e.g., NEF. rem rem * To see more detail about the operations performed, add a -v to the exiftool command lines below. rem The level of detail increases with each of the following increments of the variable: rem -v, -v0, -v1, -v2, -v3, -v4, -v5 rem rem * This batch file requires an installed copy of ExifTool by Phil Harvey. rem rem * Download the ExifTool windows command line version and rename the file exiftool.exe. rem rem * Place the exiftool.exe file in your windows directory or on your system path. rem rem Warning: rem *************************************************************************************** rem rem --> This process overwrites the original files, so make sure you have a backup! <-- rem rem *************************************************************************************** rem rem rem ---------------------- Begin Code ------------------------------------------------------------------- Set CURRENTDIR=%CD% echo+ echo * * * Photo date/time equalize utility * * * echo+ echo Why? After running this utility, when you display, sort or geolocate your echo photos by date, they will always display, sort and geolocate the same - echo regardless of the tool, system or web site you are using. echo+ echo This utility sets all date/time metadata fields to match the master echo XMP-xmp:CreateDate date/time metadata field. echo+ echo This utility processes photo files in the current folder and its subfolders. echo The current folder is: %CURRENTDIR% echo+ echo All relevent date/time metadata fields are matched/equalized/synchronized echo in all JPG, XMP and CR2 files. echo+ echo This utility is optimized for use with photo files whose capture time was echo edited with Adobe Lightroom. Photo files edited with other programs may echo require you to edit the date/time master to target field mapping. Metadata echo date/time master to target field mapping is controlled by the file echo lr-datetime-equalize.args. echo+ echo This utility is optimized for use with Canon photo files. Other echo manufacturers' photo files may require editing the photo file extension type. echo Photo file extension type, e.g. .CR2 vs .NEF, is controlled by this echo batch file. echo+ echo This utility requires the free exiftool program by Phil Harvey. echo+ echo For more information, view these files in Notepad and read the included echo documentation: echo lr-datetime-equalize.bat echo lr-datetime-equalize.args echo+ echo V1.00 echo+ pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo * * * * * * * W A R N I N G * * W A R N I N G * * W A R N I N G * * * * * * * echo+ echo ***************************************************************************** echo * * echo * This utility makes -NO- changes to the image data of the photo files. * echo * * echo * This utility makes -NO- changes to any non-date/time metadata such as * echo * keywords/tags, captions, copyright, etc. * echo * * echo * However, when writing the date/time metadata this process overwrites the * echo * original photo files. * echo * * echo * * * * T H E R E I S N O U N D O * * * * echo * * echo * Please backup your photo files prior to using this utility! * echo * * echo ***************************************************************************** echo+ echo * * * * * * * W A R N I N G * * W A R N I N G * * W A R N I N G * * * * * * * echo+ echo The date/time metadata for all JPG, CR2 and XMP files in the current folder echo and its subfolders will be matched/equalized/synchronized by this utility. echo+ echo Current folder: %CURRENTDIR% echo+ echo+ echo Press CNTRL and C together to stop this utility and leave your files unchanged. pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo Date/time metadata fields that will be matched/equalized/synchronized: echo+ echo Master date/time source: echo XMP-xmp: echo Create Date echo+ echo Target date/time fields matched/equalized/synchronized to the master: echo EXIF: echo * Modify Date echo * Date Time Original echo * Create Date echo IPTC: echo * Date Created echo * Time Created echo * Digital Creation Date echo * Digital Creation Time echo XMP-dc: echo * Date echo XMP-EXIF: echo * Date Time Digitized echo * Date Time Original echo XMP-microsoft: echo * Date Acquired echo XMP-photoshop: echo * Date Created echo XMP-xmp: echo * Modify Date echo+ echo Target date/time fields set to the current date/time: echo * Metadata Date echo+ echo Note that different photo organizing, editing, geolocation and hosting echo applications display these date/time metadata fields with a wide variety echo of labels that often DO NOT match these field names. echo+ echo Press CNTRL and C together to stop this utility and leave your files unchanged. pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo ***************************************************************************** echo * * echo * * * * * * I M P O R T A N T * * I M P O R T A N T * * * * * * echo * * echo * If you are using Adobe Lightroom (LR), Adobe Photoshop Elements (PSE) * echo * or any other photo organizer / editor that stores information external * echo * of the photo file itself, then you need to write or save the metadata * echo * to your photos PRIOR to running this utility and read or load the * echo * metadata from your photos back into Adobe Lightroom (LR), Adobe * echo * Photoshop Elements (PSE), etc., AFTER running this utility. * echo * * echo * PRIOR to running this utility: * echo * * echo * In Lightroom: * echo * 1. Select Library module * echo * 2. Select all photos that you intend to process with this utility * echo * 3. On the menu bar at the top of the window: * echo * a. select: Metadata * echo * b. select: Save metadata to files * echo * * echo * AFTER running this utility: * echo * * echo * In Lightroom: * echo * 1. Select Library module * echo * 2. Select all photos that you processed with this utility * echo * 3. On the menu bar at the top of the window: * echo * a. select: Metadata * echo * b. select: Read metadata from files * echo * * echo ***************************************************************************** echo+ echo Press CNTRL and C together to stop this utility and leave your files unchanged. pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo * * * * * * * W A R N I N G * * W A R N I N G * * W A R N I N G * * * * * * * echo+ echo ***************************************************************************** echo * * echo * This utility makes -NO- changes to the image data of the photo files. * echo * * echo * This utility makes -NO- changes to any non-date/time metadata such as * echo * keywords/tags, captions, copyright, etc. * echo * * echo * However, when writing the date/time metadata this process overwrites the * echo * original photo files. * echo * * echo * * * * T H E R E I S N O U N D O * * * * echo * * echo * Please backup your photo files prior to using this utility! * echo * * echo ***************************************************************************** echo+ echo * * * * * * * W A R N I N G * * W A R N I N G * * W A R N I N G * * * * * * * echo+ echo Note: echo * Use this utility at your own risk. echo * No warranties or suitability of use of any kind are expressed or implied. echo+ echo Warning: echo * The date/time metadata for all JPG, CR2 and XMP files in the current echo folder and its subfolders will be matched/equalized/synchronized by echo this utility. echo+ echo Current folder: %CURRENTDIR% echo+ echo ------------------------------------------------------------------------------ echo+ echo Press CNTRL and C together to stop this utility and leave your files unchanged. echo+ echo Press any key to run this utility and equalize all date/time metadata fields. echo+ pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo This is a four step process. echo+ echo It is normal to see error messages regarding missing .xmp files in step 3. echo+ echo+ rem ======================== Text File Data Begin ========================== rem set up text file header echo+>lr-datetime-equalize.txt echo * * * Photo date/time equalize utility * * *>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Utility run on: %date% %time%>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Run in folder and its subfolders: %CURRENTDIR%>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo This is a 4 step process.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 1 of 4:>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW files.>>lr-datetime-equalize.txt rem ======================== Text File Data End ========================== echo Step 1 of 4: echo Writing the master date/time into the Canon CR2 RAW files rem rem The following command line writes the date/time into the Canon CR2 RAW files rem exiftool -tagsFromFile %%d/%%f.xmp -r -@ lr-datetime-equalize.args -ext CR2 -ext cr2 . -overwrite_original -v0>>lr-datetime-equalize.txt rem rem echo+ echo Writing the master date/time into the Canon CR2 RAW files complete. echo+ echo Step 1 of 4 completed. echo+ echo+ echo Step 2 of 4: echo Writing the master date/time into the Canon CR2 RAW sidecar XMP files rem ======================== Text File Data Begin ========================== echo+>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW files complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 1 of 4 completed.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 2 of 4:>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW sidecar XMP files.>>lr-datetime-equalize.txt rem ======================== Text File Data End ========================== rem rem The following command line writes the date/time into the Canon CR2 RAW sidecar XMP files rem exiftool -tagsFromFile %%d/%%f.xmp -r -@ lr-datetime-equalize.args -ext XMP -ext xmp . -overwrite_original -v0>>lr-datetime-equalize.txt rem rem echo+ echo Writing the master date/time into the Canon CR2 RAW sidecar XMP files echo complete. echo+ echo Step 2 of 4 completed. echo+ echo+ echo Step 3 of 4: echo Writing the master date/time into the Canon CR2 RAW sidecar JPG files echo+ echo It is normal to see error messages regarding missing .xmp files in step 3. echo You can ignore "Warning: Error opening file -" messages in step 3. echo+ rem ======================== Text File Data Begin ========================== echo+>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW sidecar XMP files complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 2 of 4 completed.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 3 of 4:>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW sidecar JPG files.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo It is normal to see error messages in step 3.>>lr-datetime-equalize.txt echo You can ignore "Nothing changed in" messages in step 3.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt rem ======================== Text File Data End ========================== rem rem The following command line writes the date/time into the Canon CR2 RAW sidecar JPG files rem exiftool -tagsFromFile %%d/%%f.xmp -r -@ lr-datetime-equalize.args -ext JPG -ext jpg . -overwrite_original -v0>>lr-datetime-equalize.txt rem rem echo+ echo It is normal to see error messages regarding missing .xmp files in step 3. echo You can ignore "Warning: Error opening file -" messages in step 3. echo+ echo Writing the master date/time into the Canon CR2 RAW sidecar JPG files echo complete. echo+ echo Step 3 of 4 completed. echo+ echo+ echo Step 4 of 4: echo Writing the master date/time into the JPG files rem ======================== Text File Data Begin ========================== echo+>>lr-datetime-equalize.txt echo It is normal to see error messages regarding files in step 3.>>lr-datetime-equalize.txt echo You can ignore "Nothing changed in" messages in step 3.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Writing the master date/time into the Canon CR2 RAW sidecar JPG files complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 3 of 4 completed.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 4 of 4:>>lr-datetime-equalize.txt echo Writing the master date/time into the JPG files>>lr-datetime-equalize.txt rem ======================== Text File Data End ========================== rem rem The following command line writes the date/time into the JPG files rem exiftool -tagsFromFile %%d/%%f.jpg -r -@ lr-datetime-equalize.args -ext JPG -ext jpg . -overwrite_original -v0>>lr-datetime-equalize.txt echo+ echo Writing the master date/time into the JPG files complete. echo+ echo Step 4 of 4 completed. echo+ echo+ echo Summary: echo 1. Writing the master date/time into the Canon CR2 RAW files complete. echo 2. Writing the master date/time into the Canon CR2 RAW sidecar XMP files echo complete. echo 3. Writing the master date/time into the Canon CR2 RAW sidecar JPG files echo complete. echo 4. Writing the master date/time into the JPG files complete. echo+ echo All steps complete. echo+ rem ======================== Text File Data Begin ========================== echo+>>lr-datetime-equalize.txt echo Writing the master date/time into the JPG files complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Step 4 of 4 completed.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo Summary:>>lr-datetime-equalize.txt echo 1. Writing the master date/time into the Canon CR2 RAW files complete.>>lr-datetime-equalize.txt echo 2. Writing the master date/time into the Canon CR2 RAW sidecar XMP files>>lr-datetime-equalize.txt echo complete.>>lr-datetime-equalize.txt echo 3. Writing the master date/time into the Canon CR2 RAW sidecar JPG files>>lr-datetime-equalize.txt echo complete.>>lr-datetime-equalize.txt echo 4. Writing the master date/time into the JPG files complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt echo All steps complete.>>lr-datetime-equalize.txt echo+>>lr-datetime-equalize.txt rem ======================== Text File Data End ========================== pause cls echo+ echo * * * Photo date/time equalize utility * * * echo+ echo All date/time metadata fields are now matched/equalized/synchronized for all echo JPG, CR2 and XMP files in the current folder and its subfolders. echo+ echo Current folder: %CURRENTDIR% echo+ echo Now, when you display, sort or geolocate your photos by date, they echo will always display, sort and geolocate the same - regardless of the echo tool, system or web site you are using. echo+ echo+ echo ***************************************************************************** echo * * echo * * * * * * I M P O R T A N T * * I M P O R T A N T * * * * * * echo * * echo * If you are using Adobe Lightroom (LR), Adobe Photoshop Elements (PSE) * echo * or any other photo organizer / editor that stores information externally * echo * of the photo file itself, then you need to now read or load the * echo * metadata from your photos back into Adobe Lightroom (LR), Adobe * echo * Photoshop Elements (PSE), etc. * echo * * echo * * echo * In Lightroom: * echo * 1. Select Library module * echo * 2. Select all photos that you processed with this utility * echo * 3. On the menu bar at the top of the window: * echo * a. select: Metadata * echo * b. select: Read metadata from files * echo * * echo ***************************************************************************** echo+ echo+ echo Detailed information regarding the JPG, CR2 and XMP photo files changed in echo this run of the utility is available in the text file: echo %CURRENTDIR%\lr-datetime-equalize.txt echo+ echo+ pause rem ---------------------- End Code -------------------------------------------------------------------