Create Canon DSLR CR2 image statistics (exiftool & GNU Plot) and convert ML dual ISO CR2 files painlessly for post-processing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

  1. #!/bin/bash
  2. ################################################################################################
  3. # File system check
  4. # We don't allow writing to SD card.
  5. #Sed is here to remove any trailing spaces and crap like blank lines
  6. INPUT_FILESYSTEM=$(df -h "${1}" | awk -F ' ' 'FNR> 1 {print $1}' | grep -i -E "/dev/sd?|/dev/hd?|?rewritefs|?tmpfs|/dev/nvme?" | sed '/^\s*$/d' | wc -l)
  7. if [[ "${INPUT_FILESYSTEM}" -eq 0 ]]; then #if input file (first file printed in bash) filesystem does not start with /dev/sdX
  8. kdialog --error "Image(s) are in a SD Card. Please move them your local or external storage and try again."
  9. exit
  10. fi
  11. ################################################################################################
  12. #We get the directory just from the first filename. Pwd should be easier, but bugged, so...
  13. INPUT_DIR=$(dirname "${1}")
  14. DIR_BASENAME=$(echo "${INPUT_DIR}" | rev | cut -d/ -f 1 | rev)
  15. while [[ $# -gt 0 ]]; do
  16. ################################################################
  17. # Values that change during the while loop (differ from file to file)
  18. INPUT="${1}"
  19. MTIME=$(exiftool -d "%s" -DateTimeOriginal -s -S "${INPUT}")
  20. touch --date=@${MTIME} "${INPUT}"
  21. shift # Move to the next file
  22. done