Skip to content

Instantly share code, notes, and snippets.

@nicewook
Last active December 29, 2017 17:18
Show Gist options
  • Save nicewook/6e0ef507a5b15ed7a879a81e8336e758 to your computer and use it in GitHub Desktop.
Save nicewook/6e0ef507a5b15ed7a879a81e8336e758 to your computer and use it in GitHub Desktop.
#!/bin/bash
c=1; d=1; mkdir -p dir_${d}
for file in *
do
if [ $c -eq 3001 ]
then
d=$(( d + 1 )); c=0; mkdir -p dir_${d}
fi
mv "$file" dir_${d}/
c=$(( c + 1 ))
done
@nicewook
Copy link
Author

  1. 현재폴더에 파일이 엄청 많고,
  2. 이를 sub 폴더에 같은 개수만큼 나눠서 담고 싶을때 사용하는 스크립트

위 코드에서는 띄어쓰기마저 중요하다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment