#list all files in the current directory without recursing and put the compressed image on the ''comp'' subdirectory

# shellcheck disable=SC2267
find . -maxdepth 1 -type f -print0 | xargs -r -0 -ixxx xxx ./comp/xxx.jpg

#for all the files with weird extension, e.g. JPG, this leads to an additional extension, fix this:
(
  cd comp/ || return
  for i in *.JPG.jpg; do
    mv "${i}" "${i%.JPG.jpg}".jpg
  done
)

#recreate the modified date from EXIF information
# shellcheck disable=SC2312,SC2016,SC2046
(
  cd comp/ || return
  for i in *.jpg; do
    touch -t $(exiftool -p '$DateTimeOriginal' "${i}" \
      | sed 's/[: ]//g' | sed 's/\(..$\)/\.\1/') "${i}"
  done
)
