Skip to content

Instantly share code, notes, and snippets.

@aln787
Last active December 17, 2018 12:56
Show Gist options
  • Save aln787/cac3cdeda402bad57f1af673b09d15b5 to your computer and use it in GitHub Desktop.
Save aln787/cac3cdeda402bad57f1af673b09d15b5 to your computer and use it in GitHub Desktop.
Photo Renaming Commands

Photo Renaming Commands

Commonly Used Commands:

  • find *.jpg | while read i; do echo $i && mv "$i" "${i// /_}"; done
  • find *.jpg | while read i; do nn=$(echo $i | tr "'" "-") && echo $nn && mv "$i" "$nn"; done
  • find *.jpg | while read i; do echo $i && mv {,StudyAbroadAmsterdam-}${i}; done
  • mv ./* .. && ls && cd ..

Commands:

  • find *.jpg | while read i; do echo $i && mv {,StudyAbroadAmsterdam-}${i}; done
  • for i in *.JPG; do echo $i && mv {,West-Virginia_Visit-}${i}; done
  • mv ./* .. && cd ..
  • ls west/
  • rm -r west/

Other Commands:

  • for i in *\ *; do echo $i && mv "$i" "${i// /_}"; done

  • for i in $(ls Macys_Day_Parade_2003-D*); do echo $i && mv $i $(echo $i | awk -F '2003-' '{print $2}'); d

  • find *.jpg | while read i; do echo $i && mv "$i" "${i// /_}"; done

  • find . -iname "*.jpg" | while read -r i; do fn=$(echo $i | cut -c 3-) && echo $fn && mv "$fn" "${fn// /_}"; done

  • find . -iname "*.jpg" | head -1 | while read -r i; do fn=$(echo $i | cut -c 3-) && echo $fn && mv "$fn" "${fn// /_}" && ls *.jpg | head -1; done

  • find *.jpg | head -1 | tr "'" "-"

  • find *.jpg | while read i; do nn=$(echo $i | tr "'" "-") && echo $nn && mv "$i" "$nn"; done

  • find *.jpg | head -1 | while read -r i; do echo $i && nn=$(echo $i | tr "'" "-") && echo $nn && mv "$i" "$nn"; done

  • find *.jpg | while read -r i; do echo $i && nn=$(echo $i | tr "'" "-") && echo $nn && mv "$i" "$nn"; done

  • find * -type d

  • find / -type d -name "dir-name-here"

  • find *-*.jpg | while read i; do echo $i && on=$(echo $i | tail -1 | cut -d'-' -f2) && echo $on && mv "$i" "$on"; done

  • find nyc* | while read i; do echo $i && on=$(echo $i | cut -d'-' -f2) && echo $on && mv "$i" "NYC_2011-$on"; done

  • find *.MP4 | wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment