Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -x
- typeset -g DIR=$1
- typeset -ig files=$(ls -v ${DIR} | wc -l)
- typeset -i i=1
- for (( ; ; i++)); do
- mkdir -p 'Directory_'${i}
- if (( i * 5 >= files )); then break; fi
- done
- (( i = 1 ))
- typeset -i j=0
- find ${DIR} -type 'f' | sort -V |
- while read; do
- mv -t 'Directory_'${i} ${REPLY}
- if (( ++j % 5 == 0 )); then (( i++ )); fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement