createSubdirectoriesForFiles.sh 200 B

123456789101112
  1. #/bin/bash
  2. # This script will create a directory every 100 files and move files inside
  3. i=0;
  4. for f in *;
  5. do
  6. d=dir_$(printf %06d $((i/1000+1)));
  7. mkdir -vp $d;
  8. mv "$f" $d;
  9. let i++;
  10. done