Last active
July 13, 2021 01:00
-
-
Save yinguobing/77857dd79c3dc927e886d9fb34f629a6 to your computer and use it in GitHub Desktop.
Split files in one directory into many dirs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=0 | |
for i in * | |
do | |
if [ $((n+=1)) -gt 50 ]; then | |
n=1 | |
fi | |
todir=../my_file$n | |
[ -d "$todir" ] || mkdir "$todir" | |
mv "$i" "$todir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment