|
내가 만든 프로젝트 파일을 백업해서 관리하려고,
현재 폴더에서 특정 하위 폴더를 제외한 나머지 파일&폴더를 압축 하고 싶어 구글링을 했는데.
tar [옵션] [압축파일명] [--exclude=] [제외할파일종류] [압축대상경로]
위와 같은 방식으로 하라고 되어있었는데도 불구하고..
tar zcvf --exclude= backup/ project.tar.gz ./*
위와 같이 쌩뚱맞게 명령어를 날리고 말았다. (무슨 생각으로 저 명령어를 날린거지..)
결과는...
현재폴더를 모두 압축하여 "--exclude" 라는 파일명으로 압축이 되어버렸다..
그래서 "--exclude" 파일을 삭제하고 다시 압축을 하기로 결정!
> rm --exclude
삭제가 되지 않는다..
"-" 특수문자 때문인 것 같아.. 알아보던중
> man rm 을 해보니
The rm command uses getopt(3) to parse its arguments, which allows it to accept the `--' option which will cause it to stop processing flag options at that point. This will allow the removal of file names that begin with a dash (`-'). For example:
rm -- -filename
The same behavior can be obtained by using an absolute or relative path reference. For example:
rm /home/user/-filename rm ./-filename
When -P is specified with -f the file will be overwritten and removed even if it has hard links.
이렇게 되어져 있어..
> rm -- --exclude
로 삭제 하였다 ㅠㅠ
다시 특정폴더 제외 한 압축으로 돌아가
> tar -zcvf shoppingbox_20150501.tar.gz --exclude=backup/ ./*
이렇게 압축을 성공 하였다!!
|