![현재 디렉터리의 모든 항목을 압축합니다.](https://linux55.com/image/19793/%ED%98%84%EC%9E%AC%20%EB%94%94%EB%A0%89%ED%84%B0%EB%A6%AC%EC%9D%98%20%EB%AA%A8%EB%93%A0%20%ED%95%AD%EB%AA%A9%EC%9D%84%20%EC%95%95%EC%B6%95%ED%95%A9%EB%8B%88%EB%8B%A4..png)
현재 디렉터리의 파일과 폴더를 포함한 모든 것을 Ubuntu의 단일 ZIP 파일로 압축하고 패키지하고 싶습니다.
가장 편리한 명령은 무엇입니까(그리고 설치해야 하는 도구의 이름(있는 경우))은 무엇입니까?
편집: 폴더나 여러 파일을 제외해야 하는 경우 어떻게 해야 합니까?
답변1
설치 zip
및 사용
zip -r foo.zip .
-0
(None)에서 (Best)로의 플래그를 사용하여 -9
압축 비율을 변경할 수 있습니다 .
플래그를 통해 파일을 제외 할 수 있습니다 -x
. 매뉴얼 페이지에서:
-x files
--exclude files
Explicitly exclude the specified files, as in:
zip -r foo foo -x \*.o
which will include the contents of foo in foo.zip while excluding all the files that end in .o. The backslash avoids the shell filename substitution, so that the name matching
is performed by zip at all directory levels.
Also possible:
zip -r foo foo [email protected]
which will include the contents of foo in foo.zip while excluding all the files that match the patterns in the file exclude.lst.
The long option forms of the above are
zip -r foo foo --exclude \*.o
and
zip -r foo foo --exclude @exclude.lst
Multiple patterns can be specified, as in:
zip -r foo foo -x \*.o \*.c
If there is no space between -x and the pattern, just one value is assumed (no list):
zip -r foo foo -x\*.o
See -i for more on include and exclude.