Skip to content

Instantly share code, notes, and snippets.

@corolla96
Created August 13, 2022 20:42
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 corolla96/8896ddc1525ecda13335bd01a07745ab to your computer and use it in GitHub Desktop.
Save corolla96/8896ddc1525ecda13335bd01a07745ab to your computer and use it in GitHub Desktop.
folder_count=$(($(ls | wc -l) / 1000 + 1))
for (( i=1; i<=$folder_count; i++ ))
do
d=dir_$(printf %03d $i);
mkdir -p $d;
done
j=0;
for f in $(find . -maxdepth 1 -type f);
do
d=dir_$(printf %03d $((j/1000+1)));
mv "$f" $d;
let j++;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment