본문 바로가기
리눅스/Bash

[tar] tar 를 이용하여 압축시 특정 파일 제외하기

by hs_seo 2017. 7. 21.

tar 명령을 이용하여 파일을 압축할 때 exclude 옵션을 이용하여 

특정 파일을 제외할 수 있다. 


<지정한 디렉토리를 file.tar.gz 으로 압축하고, .log, .attatch 로 끝나는 파일, folder_name 디렉토리 제외>

tar -zcvf file.tar.gz source_dir_name --exclude="*.log" --exclude="*.attach*" --exclude="./folder_name"


반응형