Skip to content

Instantly share code, notes, and snippets.

@haoxi911
Created March 15, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haoxi911/8a9df6696dff32dd33b8fb72fb27b940 to your computer and use it in GitHub Desktop.
Save haoxi911/8a9df6696dff32dd33b8fb72fb27b940 to your computer and use it in GitHub Desktop.
Split images into subfolders on Oxford IIIT Pet dataset
# /bin/sh
# this script categorize image files by moving them into subfolders
# using the name of animals.
for f in *.jpg; do
name=`echo "$f"|sed 's/ -.*//'`
dir=`echo "${name%_*}"|tr '_' ' '| tr '[A-Z]' '[a-z]'`
mkdir -p "$dir"
mv "$f" "$dir"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment