하기 내용은
핀란드 헤이키님의 글 <2013.10.08 09:31 http://blog.daum.net/rayolla/486>
을 재구성이라기 보다는 Ctrl+C, Ctrl+V 한 내용입니다.
Linux 특정 폴더 상에 폴더 별 압축을 진행하는 shell script 입니다.
# vi tar_folder.sh
#!/bin/sh
DIRS=`ls -l $PWD | egrep '^d' | awk '{print $9}'`
# "ls -l $MYDIR" = get a directory listing
# "| egrep '^d'" = pipe to egrep and select only the directories
# "awk '{print $9}'" = pipe the result from egrep to awk and print only the 9th field
for DIR in $DIRS
do
echo ${DIR}
tar czvf ${DIR}.tar.gz ${DIR}
#rm -rf ${DIR}
done
참고: http://moinne.com/blog/ronald/bash/list-directory-names-in-bash-shell
728x90
'Resources' 카테고리의 다른 글
[Linux] Dos <-> UNIX 파일 내의 줄바꿈 변경 (0) | 2017.01.11 |
---|---|
[QT] 5.7.1 설치 (0) | 2017.01.09 |
[COM] 대세는 클라우드? (4) | 2011.06.24 |
@tistory.com? 티스토리에도 메일이 !! (0) | 2011.06.22 |
QT-20 32G USB Memory (4) | 2011.06.21 |