Установка архиватора ZIP в операционной системе FreeBSD

Задача:
---------------------------------------------------------------Установить и настроить поддержку архивов zip в операционной системе FreeBSD
Установка Unzip из портов (для распаковки архивов)
cd /usr/ports/archivers/unzip; make install; make clean
Установка Zip из портов (для упаковки файлов или папок в архив)
cd /usr/ports/archivers/zip; make install; make clean
Установка при помощи пакетного менеджера PKG
pkg install unzip zip
Параметры запуска:
Ключи для использования с командой ZIP
root@ws1:/ # zip Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license. Zip 3.0 (July 5th 2008). Usage: zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list] The default action is to add or replace zipfile entries from list, which can include the special name - to compress standard input. If zipfile and list are omitted, zip compresses stdin to stdout. -f freshen: only changed files -u update: only changed or new files -d delete entries in zipfile -m move into zipfile (delete OS files) -r recurse into directories -j junk (don't record) directory names -0 store only -l convert LF to CR LF (-ll CR LF to LF) -1 compress faster -9 compress better -q quiet operation -v verbose operation/print version info -c add one-line comments -z add zipfile comment -@ read names from stdin -o make zipfile as old as latest entry -x exclude the following names -i include only the following names -F fix zipfile (-FF try harder) -D do not add directory entries -A adjust self-extracting exe -J junk zipfile prefix (unzipsfx) -T test zipfile integrity -X eXclude eXtra file attributes -y store symbolic links as the link instead of the referenced file -e encrypt -n don't compress these suffixes -h2 show more help
Ключи для использования с командой UNZIP
root@ws1:/ # unzip Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] zipfile
Примеры использования:
Создание архива из указанных файлов и папок
zip archive file1 file2 folder1
Создание архива текущего каталога (архив создается без подкаталогов)
zip archive *
Создание архива из указанных файлов и папок
zip archive file1 file2 folder1
Создание архива включая все подкаталоги
zip archive * -r
Создание архива с скрытыми файлами и каталогами
zip archive . -r
Указываем степень сжатия. Можно от 1 до 9
zip archive . -9 -r
Исключаем файлы и каталоги из архива
zip archive . -9 -r -x "assets/*" "media/*" "robots.txt" ".htaccess" zip archive . -r -x "ted/" ".xml"
Таким способом я исключаю все каталоги заканчивающихся на ted и файлы расширения xml
Разбиваем архив на части с помощью опции -s. есть возможность указать опцию размера части архива в: k (KB), m (MB), g (GB), t (TB)
zip archive . -9 -r -s 5m
Задать пароль можно опцией -e или опцией -P …
zip archive . -9 -r -e
Выбрать только указанные файлы/каталоги
zip archive . -r -i /.php /media/
Удаление файлов из созданного архива
zip archive -d /protected/* sitemap.xml
Обновить содержимое созданного архива
zip archive -r -u protected/* sitemap.xml
Тихий режим (Полезно, например, в сценариях оболочки и фоновых задач)
zip archive . -r -q
Извлечь все содержимое архива
unzip archive
Извлечь все содержимое архива в указанную директорию
unzip archive -d tmp/
Показать содержимое архива
unzip archive -l
Извлечь конкретный файл из архива
unzip archive -d tmp/ protected/*
Свежие комментарии