Split contents of a directory into multiple sub directories

Just run this and hit enter in tme command line

i=0; 
for f in *; 
do 
    d=dir_$(printf %03d $((i/100+1))); 
    mkdir -p $d; 
    mv "$f" $d; 
    let i++; 
done

Leave a comment