News for hackers. Stuff that matters.
Re:Move all photos from Google takeout into one directory by Symbiote on Wednesday November 02, 2022 @04:51AM (#33432903)
Zsh:

  mkdir photos
  mv -v **/*.jpg **/*.mp4 photos
Bash:

  shopt -s globstar
  mkdir photos
  mv -v **/*.jpg **/*.mp4 photos
But I think I'd prefer them in a directory based on the EXIF date in the photo anyway:

Zsh:

  for i in **/*.jpg; do
    date=$(exif $i --machine-readable --tag=0x9003 | head -c 10 | tr : -)
    if [[ -n $date ]]; then
      mkdir -p $date
      mv -v $i $date
    else
      mkdir -p Unknown
      mv -v $i Unknown
      # (Check other EXIF values, e.g. DateTimeOriginal.)
    fi
  done

There are no comments on this comment yet.