Skip to content

Instantly share code, notes, and snippets.

@hezila
Created March 16, 2013 08:55
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 hezila/5175579 to your computer and use it in GitHub Desktop.
Save hezila/5175579 to your computer and use it in GitHub Desktop.
split multifiles into sub-folders
# from http://ubuntuforums.org/showthread.php?t=976447
let fileCount=200
let dirNum=1
for f in *
do
[ -d $f ] && continue
[ $fileCount -eq 200 ] && {
dir=$(printf "%03d" $dirNum)
mkdir $dir
let dirNum=$dirNum+1
let fileCount=0
}
mv $f $dir
let fileCount=$fileCount+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment