Created
March 15, 2018 09:00
-
-
Save haoxi911/8a9df6696dff32dd33b8fb72fb27b940 to your computer and use it in GitHub Desktop.
Split images into subfolders on Oxford IIIT Pet dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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