Skip to content

robots4life/checkCR2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Check CR2 files for corrupted data

This script assumes that both dcraw and identify (from ImageMagick) are installed and available in your system's PATH.

https://www.dechifro.org/dcraw/

https://imagemagick.org/script/identify.php

If not, you may need to provide the full paths to the executables in the script.

sudo apt-get install dcraw
chmod +x checkCR2.sh
checkCR2.sh /path/to/folder_with_cr2_files/to_check

This script

  • creates a list of all subdirectories given the parent directory passed in as argument
  • leaves the original files untouched
  • checks the CR2 files metadata
  • checks the extracted JPEG file from the CR2 file for corruption
  • if no file corruption is found in the temporary JPEG file the JPEG file is deleted
  • if file corruption is present the affected CR2 file will be copied to a "damaged" folder in the current path, the temporary JPEG file will be deleted and not copied to the "damaged" folder
  • checks the JPEG, PNG and GIF files with identify
  • if file corruption is present in a JPEG, PNG or GIF file, the affected file will be copied to a "damaged" folder in the current path
  • a detailed file report will be generated
  • a list of all damaged files will be generated
  • if all files are ok all log files and temporary files will be deleted
  • all original modification times and creation times of all directories and all subdirectories are stored and restored before the script completes