Split a folder into multiple subfolders in terminal/bash script
Try something like this: for i in `seq 1 20`; do mkdir -p “folder$i”; find . -type f -maxdepth 1 | head -n 2000 | xargs -i mv “{}” “folder$i”; done Full script version: #!/bin/bash dir_size=2000 dir_name=”folder” n=$((`find . -maxdepth 1 -type f | wc -l`/$dir_size+1)) for i in `seq 1 $n`; do mkdir -p … Read more