Содержание
- Linux: Как архивировать с помощью zip
- Ranger: «zip error: Nothing to do!» — But it works in bash!
- 3 Answers 3
- `zip` works in shell but not in Python script
- 1 Answer 1
- zip error — нечего делать
- 3 ответа
- zip error — нечего делать
- 3 ответа
Linux: Как архивировать с помощью zip
На самом деле, всё описанное тут, весьма тривиально, но, лично у меня, возникли достаточно большие проблемы как с попыткой интуитивного использования командной утилиты для архивирования zip, так и с чтением документации. Почему-то, tar и gzip для меня гораздо проще и понятней, а для того чтобы заархивировать директорию с помощью zip ушло далеко не 5 минут и наш диалог с zip, какое-то время, заканчивался заявлениями «zip error: Nothing to do!» — мол, ничего не поделать тут. Man-pages для zip тоже показались весьма запутанными. Поэтому, чтобы не гуглить в следующий раз, выкладываю краткую инструкцию по архивирования с помощью zip’а в linux из-под консоли.
Ставим сам пакет, для дистрибутивов на основе debian это выглядит так:
sudo apt-get install zip
Архивируем нужную папку:
zip -9 zetblog.zip -r zetblog -x «*.git*» -x «*.venv*» -z
Небольшое пояснение к аргументам zip:
- -9 — задаёт степень сжатия, 9 — самое сильное и самое медленное;
- zetblog.zip — имя архива который надо создать;
- -r — флаг рекурсивного обхода;
- zetblog — диреткория, которую будем архивировать;
- -x — не добавлять в архив файлы и директории, которые попадают под указанную маску;
- -z — этот флаг означает что мы хотим ввести комментарий для архива, комментарий будет считан из stdin, для завершения ввода нужно ввести строку содержащую одну точку и больше ничего.
Остальное можно подглядеть читая man zip.
Источник
Ranger: «zip error: Nothing to do!» — But it works in bash!
The following works:
It produced a file called tmp.zip, saving me the trouble to repeat the folder name as the name of the zip archive.
In my rifle.conf (ranger specific configuration file) I have:
The «$@» translates to the path. This works fine, I make use of this a lot.
But when I try it, the error I get is:
This has worked fine for me, too. It only stopped working after upgrading my OS and with it ranger. So there is likely something I am missing here.
3 Answers 3
The brace expansion which turns foobaz into foobarbaz foocbsbaz is done by bash when interpreting a command line. So the most probable explanation is that since the upgrade, ranger doesn’t use bash for the execution of the command anymore.
Regrettably, ranger does not seem to document which shell it uses to interpret the commands in rifle.conf or whether that can be influenced. You may try to set the SHELL environment variable to /bin/bash in various places to see if it helps. If all else fails, write a wrapper shell script starting with #!/bin/bash around your command.
What was actually going on here is that ranger does a thing where if you execute files via shortcuts that things are executed as configured. In the case for shell this meant to do a call to «sh».
In previous versions of Linux Mint sh was just symlinked to bash, so the shortcut worked as «bash» in practice, even if if under the hood it was defined as sh.
But in the newer version, sh is no longer symlinked to bash, so you get a different shell and bash scripts throw weird errors, because they aren’t executed as bash by the shortcut.
Источник
`zip` works in shell but not in Python script
According to this post I’m calling the zip command using os.system() in Python.
At the command line it works:
When I call this from a Python script ( PATH is «/Backups/backups/20152011-120209»)
What am I doing wrong?
I want to zip a directory (including its content) to a zip file with the same name at the same place (a script dumps my MySQL databases to *.sql files and I want to zip the files after that).
1 Answer 1
Before getting to the problem, I’ll quote Jacob Vlijm’s comment under this answer (thanks for the comment and for the link):
[. ] using os.system at all is a really bad idea. Outdated and deprecated. Use subprocess.call() or subprocess.Popen() intead.
Here’s the first (or one of the first) deprecation proposal, dated back to 2010.
So you should really use subprocess.Popen() instead of os.system() .
When you run os.system() the command is executed in Dash ( /bin/sh ), while when you run the command in a terminal the command is executed in Bash ( /bin/bash );
Dash doesn’t support brace expansion and interprets <.zip,>literally;
Run the command in Bash: change
Or anyway as Darael suggests FWIW passing /Backups/backups/20152011-120209 <.zip,>to expand /Backups/backups/20152011-120209 to /Backups/backups/20152011-120209.zip and /Backups/backups/20152011-120209 you might as well just pass the paths directly avoiding to spawn another shell:
Источник
zip error — нечего делать
Я пытаюсь заархивировать все папки в данном каталоге. Я написал это
Вот что это содержит
3 ответа
Проблема в том, что вы не указали имя для создаваемых zip-файлов.
Это создаст отдельные заархивированные каталоги для каждой из подпапок tmp tmp_dkjg и tmp_dsf
Если вы хотите создать zip-файл из списка файлов , вам необходимо указать zip-файл и файлы, которые вы будете заархивировать. например zip myZippedImages.zip alice.png bob.jpg carl.svg .
Если они находятся в папке , zip -r myZippedImages.zip images_folder
Чтобы сделать его более понятным, чем ответ Алекса, для создания zip-файла zip принимает как минимум 2 аргумента. Откуда мне знать, потому что, когда вы используете man zip , вы получаете его справочную страницу, часть которой:
И когда вы наберете zip в командной строке, вы получите:
В обоих случаях обратите внимание на [zipfile list] или [zipfile [file . ]] . Квадратные скобки указывают на то, что необязательно . Если вы сохраняете не в zip-файл, аргумент list не требуется.
Если вы хотите сохранить в zip-файл (выбрав параметр [zipfile list] , вам также необходимо указать list , потому что он заключен в квадратные скобки. По этой причине я предпочитаю вывод <> вместо man zip . (справочная страница может сбивать с толку)
Если вы использовали команду zip для zip-файла, вы увидите эту ошибку. убедитесь, что вы не используете zip-файл с версией zip-файла, в противном случае используйте unzip
Источник
zip error — нечего делать
Я пытаюсь заархивировать все папки в данном каталоге. Я написал это
Вот что это содержит
3 ответа
Проблема в том, что вы не указали имя для создаваемых zip-файлов.
Это создаст отдельные заархивированные каталоги для каждой из подпапок tmp tmp_dkjg и tmp_dsf
Если вы хотите создать zip-файл из списка файлов , вам необходимо указать zip-файл и файлы, которые вы будете заархивировать. например zip myZippedImages.zip alice.png bob.jpg carl.svg .
Если они находятся в папке , zip -r myZippedImages.zip images_folder
Чтобы сделать его более понятным, чем ответ Алекса, для создания zip-файла zip принимает как минимум 2 аргумента. Откуда мне знать, потому что, когда вы используете man zip , вы получаете его справочную страницу, часть которой:
И когда вы наберете zip в командной строке, вы получите:
В обоих случаях обратите внимание на [zipfile list] или [zipfile [file . ]] . Квадратные скобки указывают на то, что необязательно . Если вы сохраняете не в zip-файл, аргумент list не требуется.
Если вы хотите сохранить в zip-файл (выбрав параметр [zipfile list] , вам также необходимо указать list , потому что он заключен в квадратные скобки. По этой причине я предпочитаю вывод <> вместо man zip . (справочная страница может сбивать с толку)
Если вы использовали команду zip для zip-файла, вы увидите эту ошибку. убедитесь, что вы не используете zip-файл с версией zip-файла, в противном случае используйте unzip
Источник
10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Arg list too long error while performing tar and zip operation
hi all
i am trying to tar and then zip files present dir by using the below command
tar -cvf ${abc}/xyz_backup_date_`date +%d%m%y%H%M%S`.tar xyz*
when the files are in less number the above command executes perfectly but when there are large number of files i am getting «arg list too… (5 Replies)
Discussion started by: manoj
2. Shell Programming and Scripting
How can we Zip multiple files created on the same date into one single zip file.?
Hi all i am very new to shell scripting and need some help from you to learn
1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder.
2)Post zipping… (1 Reply)
Discussion started by: b.saipriyanka
3. UNIX for Beginners Questions & Answers
How can we Zip multiple files created on the same date into one single zip file.?
Hi all i am very new to shell scripting and need some help from you to learn
1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder.
2)Post zipping… (2 Replies)
Discussion started by: b.saipriyanka
4. Shell Programming and Scripting
Zip Multiple files to One .zip file in AIX system
Hi
I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want.
One I do .zip file, I should be able to unzip in my local Computer.
Here is example what I want… (9 Replies)
Discussion started by: RAMA PULI
5. UNIX for Dummies Questions & Answers
Zip a file with .zip extension.
Hi,
I need to zip a .dat file with .zip extension. I tried using the «zip» command. But shell says. «ksh: zip: not found»
Currently I am using gunzip to zip and changing the extension «.gz» to «.zip» as follows.
mv $file `echo $file | sed ‘s/(.*.)gz/1zip/’`
But when I tried… (1 Reply)
Discussion started by: aeroticman
6. AIX
ZIP multiple files and also specify size of zip file
I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created.
How we can achieve this in UNIX?
I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a… (1 Reply)
Discussion started by: tom007
7. UNIX for Dummies Questions & Answers
Zip command (zip folder doesn’t include a folder of the same name)
Hi guys,
I have a question about the zip command. Right now I have a directory with some files and folders on it that I want to compress. When I run the zip command:
zip foo -r
I am getting a foo.zip file that once I unzip it contains a foo folder. I want to create the foo.zip, but that… (1 Reply)
Discussion started by: elioncho
8. UNIX for Dummies Questions & Answers
zip error
Having problems using the -m option when zipping up a file
# zip -m test *.jpg
zip error: Invalid command arguments (no such option: .)
# zip -m test.jpg *.jpg
zip error: Invalid command arguments (no such option: .)
any clue on what is causing this error?
It used to work… (5 Replies)
Discussion started by: mcraul
9. UNIX for Dummies Questions & Answers
unzip .zip file and list the files included in the .zip archive
Hello,
I am trying to return the name of the resulting file from a .zip archive file using unix unzip command.
unzip c07212007.cef7081.zip
Archive: c07212007.cef7081.zip
SecureZIP for z/OS by PKWARE
inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00
I used the following command to unzip in… (5 Replies)
Discussion started by: oracledev
10. UNIX for Dummies Questions & Answers
Zip Error
Hi I would like to zip a directory of files while using «gzip *.*» or «ls | xargs gzip»
both prompted me arg list too long.
Can someone kindly advise me on how o overcome this. Thank you! (0 Replies)
Discussion started by: gelbvonn
- Печать
Страницы: [1] 2 Все Вниз
Тема: Создание бекапа папок [Решено] (Прочитано 1829 раз)
0 Пользователей и 1 Гость просматривают эту тему.

slavush
Необходимо бекапить файлы — папки с облака и локальные файты с Desktop и папку Документы,
хочу подключить скриптом облако
стянуть папки, файлы с облака плюс локальные файлы с Desktop и папка Документы
их нужно заархивировать и копировать на подмонтированный раздел второго диска
делать эти бекапы ежедневно, недельно, месячно
Как мне лучше построить такой бекап? про timeshift упоминали, но он же систему бекапит
« Последнее редактирование: 18 Марта 2020, 11:15:41 от zg_nico »
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

damix

F12
slavush, а чем штатные средства Резервного копирования не устраивают?..

bezbo

ALiEN175
systemd-timers + rsync/tar/…
ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE

slavush
Спасибо, очень благодарен
добавил в автозагрузку google-drive-ocamlfuse,
теперь у меня всегда есть папка google-диск с облака которую надо бекапить
и папка локальная документы
создаю по дефолту как в примере
скрипт
/usr/local/bin/my-timer
#!/bin/bash
DATE=`date`
logger "Hi from timer script $DATE"
/etc/systemd/system/my-timer.timer
[Unit]
Description=Runs my-timer every minute
[Timer]
# Run after booting one minute
OnBootSec=1min
# Run every one hour or one munite
# OnUnitActiveSec=1h
OnUnitActiveSec=1min
Unit=my-timer.service
[Install]
WantedBy=multi-user.target
/etc/systemd/system/my-timer.service
[Unit]
Description=MyTimer for backup
[Service]
Type=simple
ExecStart=/usr/local/bin/my-timer
делаю активным демон
systemctl enable my-timer.timer
стартую его
systemctl start my-timer.timer
systemctl status my-timer.timer
● my-timer.timer - Runs my-timer every minute
Loaded: loaded (/etc/systemd/system/my-timer.timer; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2019-09-02 18:03:40 EEST; 23min ago
Trigger: n/a
сен 02 17:53:52 Shiny systemd[1]: Started Runs my-timer every minute.
сен 02 18:03:40 Shiny systemd[1]: my-timer.timer: Succeeded.
сен 02 18:03:40 Shiny systemd[1]: Stopped Runs my-timer every minute.
все работает
Мне надо чтобы 2 папки google-диск и Документы
архивировались и копировались на другой жесткий диск /mnt/sata_part
ежедневно
еженедельно
ежемесячно
это что мне надо подкорректировать?
Пользователь добавил сообщение 02 Сентября 2019, 18:46:39:
надо настроить
/etc/systemd/system/my-timer.timer
что туда прописывать, чтоб он начал по расписанию работать, без тригера по старту компьютера?
« Последнее редактирование: 02 Сентября 2019, 18:46:39 от slavush »
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

damix
slavush, так ежедневно, еженедельно или ежемесячно? Есть смысл только одно из этого делать. Или я чего-то не понял?
Тут надо поправить /usr/local/bin/my-timer (лучше дать ему расширение .sh) как-то так
/usr/local/bin/my-timer
#!/bin/bash
DATE=`date`
logger "Hi from timer script $DATE"
zip -r /mnt/sata_part/backup.zip /google/drive/path/ /home/user/Документы/
Допустим, надо бэкапить еженедельно. Тогда надо поправить /etc/systemd/system/my-timer.timer как-то так
[Unit]
Description=Runs my-timer every week
[Timer]
OnCalendar=weekly
Persistent=true
Unit=my-timer.service
[Install]
WantedBy=multi-user.target
Я не проверял работу таймера, но предполагаю, что тут OnCalendar и Persistent надо использовать. Вот тут про них подробнее написано.
Пользователь добавил сообщение 04 Сентября 2019, 18:34:06:
Архивировать можно по-разному. Можно использовать zip, а можно tar. Да и параметров у них полно. Подробнее про это знает гугл.
« Последнее редактирование: 04 Сентября 2019, 18:34:06 от damix »

slavush
Сработало,
всем спасибо, идет бекап
ежедневно копирует нужные файлы на второй диск
сейчас скрипт:
#!/bin/bash
zip -r /mnt/sata_part/backup.zip /home/slava/Документы/
и демон следующий:
[Unit]
Description=Runs my-timer
[Timer]
OnCalendar=dayly
Persistent=true
Unit=my-timer.service
[Install]
WantedBy=multi-user.target
как мне настроить чтобы, бекап работал следующим образом
в папке dayly было 7 zip файлов, бекап за каждый день недели
еженедельно в папку weekly падал 1 zip файл, бекап за неделю
ежемесячно в папку monthly падал 1 zip файл, бекап за месяц
я не сильно знаю консоль ubuntu, linux раньше работал на другой оси, на freebsd
очень рад что популярна стала так ubuntu, в тренде, работаю на ней, похоже что это самая лучшая ось, лидер, флагман
Пользователь добавил сообщение 07 Сентября 2019, 12:12:11:
столкнулся с еще одним вопросом
бекаплю google-диск
zip -r /mnt/sata_part/backup.zip /home/slava/google-диск
zip warning: name not matched: /home/slava/google-диск
zip error: Nothing to do! (try: zip -r /mnt/sata_part/backup.zip . -i /home/slava/google-диск)
root@Shiny:/usr/local/bin# zip -r /mnt/sata_part/backup.zip . -i /home/slava/google-диск
zip warning: zip file empty
папка такая точно есть, использую google-drive-ocamlfuse
Пользователь добавил сообщение 07 Сентября 2019, 12:13:30:
почему-то ее не видно из консоли, права в порядке
« Последнее редактирование: 07 Сентября 2019, 12:13:30 от slavush »
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

damix
как мне настроить чтобы, бекап работал следующим образом
в папке dayly было 7 zip файлов, бекап за каждый день недели
еженедельно в папку weekly падал 1 zip файл, бекап за неделю
ежемесячно в папку monthly падал 1 zip файл, бекап за месяц
А жесткий диск не закончится?
В смысле раз в неделю копируем все архивы за неделю или архивируем сами файлы?
Для начала
cd /mnt/sata_part
Потом поправить /usr/local/bin/my-timer как-то так
mkdir dayly
mkdir weekly
mkdir monthly
#!/bin/bash
Потом по аналогии с этим таймером создать еще два: который срабатывает еженедельно, и — ежемесячно. В их скриптах прописать то что нужно в зависимости от задачи. Я вообще не понимаю, зачем это может быть нужно.
DATE=`date +%y_%m_%d`
zip -r /mnt/sata_part/dayly/backup_$DATE.zip /home/slava/Документы/
я не сильно знаю консоль ubuntu, linux раньше работал на другой оси, на freebsd
На Ubuntu консоль такая же как и на всех линуксах, и почти такая же, как и на всех юниксах. Основные команды линукс легко гуглятся.
zip -r /mnt/sata_part/backup.zip /home/slava/google-диск
zip warning: name not matched: /home/slava/google-дискzip error: Nothing to do! (try: zip -r /mnt/sata_part/backup.zip . -i /home/slava/google-диск)
root@Shiny:/usr/local/bin# zip -r /mnt/sata_part/backup.zip . -i /home/slava/google-диск
zip warning: zip file empty
Не знаю, может, на кирилицу ругается.
почему-то ее не видно из консоли, права в порядке
ls -l ~ | grep 'google'
Что выдает?

slavush
А жесткий диск не закончится?
В смысле раз в неделю копируем все архивы за неделю или архивируем сами файлы?
Для начала
Спасибо большое за топик,
имею в виду, чтоб были файлы в папке бекап:
пн.zip
вт.zip
ср.zip
чт.zip
пт.zip
сб.zip
вс.zip
неделя.zip
месяц.zip
это ж надежно, стандарт даже
3 демона делать? а скрипт, тоже 3?
как мне обработку написать в скрипте? буду очень благодарен
ls -l ~ | grep ‘google’
$ ls -l ~ | grep ‘google’
drwxrwxr-x 2 slava slava 4096 сен 2 16:57 google-диск
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

damix
3 демона делать? а скрипт, тоже 3?
Ну наверное. Так проще всего.
Папка судя по всему есть. А если ее
ln -s -T google-диск google_drive
?
(Создать ссылку на нее без пробелов, знаков и русских букв)
как мне обработку написать в скрипте?
Так все равно непонятно, что вам нужно.
Ежедневный бэкап так
#!/bin/bash
DATE=`date +%a`
zip -r /mnt/sata_part/dayly/$DATE.zip /home/slava/Документы/
А еженедельный и ежемесячный непонятно, что бэкапить должны.

slavush
Ежедневный бэкап так
Код: [Выделить]
#!/bin/bash
DATE=`date +%a`
zip -r /mnt/sata_part/dayly/$DATE.zip /home/slava/Документы/
Благодарю, ежедневный подыму, чтоб уже работал
извините некорректно задачу поставил
ежедневный бекап все оки, недельные в папку неделя, а за месяц в папку месяцы и еще нужно за год в папку год складывать
надо 4 демона подымать: день, неделя, месяц, год
все прояснили, большое спасибо
Пользователь добавил сообщение 09 Сентября 2019, 16:52:17:
Папка судя по всему есть. А если ее
все пашет, нельзя русские буквы, с ними не проходит почему-то, вы правы. Почему, это отдельным вопросом;)
« Последнее редактирование: 09 Сентября 2019, 16:52:17 от slavush »
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

slavush
Все пашет, бекап выполняется, готово
день
неделя
месяц
год
Огромная благодарность всем, респект
Документы хранятся теперь в облаке и на втором жестком диске
Я создам еще одно место хранения, хочу подключить DVDRW и бекапировать копию доков на болванки
Пользователь добавил сообщение 10 Сентября 2019, 14:26:53:
Ребят, трабл, после того как я поднял 4 демона для бекапа, в dolphin перестал видеться гугл драйв и в бекап перестали попадать файлы с него
запускается только с sudo, раньше стартовал без sudo
$ fusermount -u /home/slava/google-drive
fusermount: entry for /home/slava/google-drive not found in /etc/mtab
$sudo fusermount -u /home/slava/google-drive
$ google-drive-ocamlfuse /home/slava/google-drive
Error: Sqlite3 error: READONLY
$ sudo google-drive-ocamlfuse /home/slava/google-drive
ls /home/slava/google-drive
ls: невозможно получить доступ к '/home/slava/google-drive': Отказано в доступе
$ sudo ls /home/slava/google-drive
все есть, дает вывод папок
но они не попадают в бекап и не видно в папке гугл их из dolphin,
бекап работает, но без папки гугл
« Последнее редактирование: 10 Сентября 2019, 14:26:53 от slavush »
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10

damix

slavush
сделал, бекап работает,
всем спасибо большое, респект
Intel CoffeeLake Core i5-9400F :: 16G 2666MHz :: SSD(m2) :: 650W :: Windows 10
Dell 3310 :: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz :: 16G DDR3 2666 MHz :: M.2 NVME :: Windows 10
- Печать
Страницы: [1] 2 Все Вверх
Я пытаюсь заархивировать все папки в данном каталоге. Я написал это
find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" ;
Но получил
zip error: Nothing to do! (/home/user/rep/tests/data/archive/tmp.zip)
zip error: Nothing to do! (/home/user/rep/tests/data/archive/tmp_dkjg.zip)
Вот что это содержит
user@machine:~$ ls /home/aliashenko/rep/tests/data/archive/
tmp tmp_dkjg tmp_dsf
3 ответа
Лучший ответ
Проблема в том, что вы не указали имя для создаваемых zip-файлов.
find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" "{}" ;
Это создаст отдельные заархивированные каталоги для каждой из подпапок tmp
tmp_dkjg
и tmp_dsf
14
Alex Telon
12 Окт 2016 в 16:43
Если вы хотите создать zip-файл из списка файлов , вам необходимо указать zip-файл и файлы, которые вы будете заархивировать. например zip myZippedImages.zip alice.png bob.jpg carl.svg
.
Если они находятся в папке , zip -r myZippedImages.zip images_folder
Чтобы сделать его более понятным, чем ответ Алекса, для создания zip-файла zip принимает как минимум 2 аргумента. Откуда мне знать, потому что, когда вы используете man zip
, вы получаете его справочную страницу, часть которой:
zip [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [--longoption ...] [-b path]
[-n suffixes] [-t date] [-tt date] [zipfile [file ...]] [-xi list]
И когда вы наберете zip
в командной строке, вы получите:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
В обоих случаях обратите внимание на [zipfile list]
или [zipfile [file ...]]
. Квадратные скобки указывают на то, что необязательно . Если вы сохраняете не в zip-файл, аргумент list
не требуется.
Если вы хотите сохранить в zip-файл (выбрав параметр [zipfile list]
, вам также необходимо указать list
, потому что он заключен в квадратные скобки. По этой причине я предпочитаю вывод {{X2} } вместо man zip
. (справочная страница может сбивать с толку)
1
Ben Butterworth
16 Ноя 2020 в 17:09
Если вы использовали команду zip для zip-файла, вы увидите эту ошибку. убедитесь, что вы не используете zip-файл с версией zip-файла, в противном случае используйте unzip
0
Mahmoud Magdy
26 Сен 2020 в 21:44
Содержание
- Zip error nothing to do linux
- DESCRIPTION
- OPTIONS
- EXAMPLES
- PATTERN MATCHING
- ENVIRONMENT
- SEE ALSO
- DIAGNOSTICS
- AUTHORS
- Zip Error Nothing To Do Linux
- How to Zip Files and Directories in Linux Linuxize
- How to Zip or Unzip Files From the Linux Terminal
- Zip Error Nothing To Do Linux Fixes & Solutions
- zipimport.ZipImportError: can’t decompress data; zlib not available
- 6 Answers 6
- Not the answer you’re looking for? Browse other questions tagged rhel python pip python3 or ask your own question.
- Related
- Hot Network Questions
- Subscribe to RSS
- Zipping and Unzipping Files under Linux
- ziping files/directories examples
- unziping files/directories examples
- Linux GUI packages
- Error: Nothing to do trying to install local RPM
- 6 Answers 6
Zip error nothing to do linux
DESCRIPTION
It is analogous to a combination of the UNIX commands tar (1) and compress (1) and is compatible with PKZIP (Phil Katz’s ZIP for MSDOS systems).
For a brief help on zip and unzip, run each without specifying any parameters on the command line.
The program is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories.
The zip program puts one or more compressed files into a single zip archive, along with information about the files (name, path, date, time of last modification, protection, and check information to verify file integrity). An entire directory structure can be packed into a zip archive with a single command. Compression ratios of 2:1 to 3:1 are common for text files. zip has one compression method (deflation) and can also store files without compression. zip automatically chooses the better of the two for each file to be compressed.
would write the zip output directly to a tape with the specified block size for the purpose of backing up the current directory.
When changing an existing zip archive, zip will write a temporary file with the new contents, and only replace the old one when the process of creating the new version has been completed without error.
OPTIONS
EXAMPLES
Even this will not include any subdirectories from the current directory.
PATTERN MATCHING
When these characters are encountered (without being escaped with a backslash or quotes), the shell will look for files relative to the current path that match the pattern, and replace the argument with a list of the names that matched.
ENVIRONMENT
SEE ALSO
DIAGNOSTICS
VMS interprets standard Unix (or PC) return values as other, scarier-looking things, so zip instead maps them into VMS-style status codes. The current mapping is as follows: 1 (success) for normal exit,
and (0x7fff000? + 16*normal_zip_exit_status) for all errors, where the `?’ is 0 (warning) for zip value 12, 2 (error) for the zip values 3, 6, 7, 9, 13, 16, 18, and 4 (fatal error) for the remaining ones.
zip files produced by zip 2.31 must not be updated by zip 1.1 or PKZIP 1.10, if they contain encrypted members or if they have been produced in a pipe or on a non-seekable device. The old versions of zip or PKZIP would create an archive with an incorrect format. The old versions can list the contents of the zip file but cannot extract it anyway (because of the new compression algorithm). If you do not use encryption and use regular disk files, you do not have to care about this problem.
Under VMS, zip hangs for file specification that uses DECnet syntax foo::*.*.
On OS/2, zip cannot match some names, such as those including an exclamation mark or a hash sign. This is a bug in OS/2 itself: the 32-bit DosFindFirst/Next don’t find such names. Other programs such as GNU tar are also affected by this bug.
Under OS/2, the amount of Extended Attributes displayed by DIR is (for compatibility) the amount returned by the 16-bit version of DosQueryPathInfo(). Otherwise OS/2 1.3 and 2.0 would report different EA sizes when DIRing a file. However, the structure layout returned by the 32-bit DosQueryPathInfo() is a bit different, it uses extra padding bytes and link pointers (it’s a linked list) to have all fields on 4-byte boundaries for portability to future RISC OS/2 versions. Therefore the value reported by zip (which uses this 32-bit-mode size) differs from that reported by DIR. zip stores the 32-bit format for portability, even the 16-bit MS-C-compiled version running on OS/2 1.3, so even this one shows the 32-bit-mode size.
Development of Zip 3.0 is underway. See that source distribution for many new features and the latest bug fixes.
Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly, Onno van der Linden, Kai Uwe Rommel, Igor Mandrichenko, John Bush and Paul Kienitz. Permission is granted to any individual or institution to use, copy, or redistribute this software so long as all of the original files are included, that it is not sold for profit, and that this copyright notice is retained.
LIKE ANYTHING ELSE THAT’S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE.
Источник
Zip Error Nothing To Do Linux
We have collected for you the most relevant information on Zip Error Nothing To Do Linux, as well as possible solutions to this problem. Take a look at the links provided and find the solution that works. Other people have encountered Zip Error Nothing To Do Linux before you, so use the ready-made solutions.
- https://unix.stackexchange.com/questions/430198/unexpected-behavior-zip-r-in-bash
- Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
How to Zip Files and Directories in Linux Linuxize
- https://linuxize.com/post/how-to-zip-files-and-directories-in-linux/
- Aug 28, 2019 · Zip files can be easily extracted in Windows, macOS, and Linux using the utilities available for all operating systems. In this tutorial, we will show you how to Zip (compress) files and directories in Linux using the zip command. zip Command # zip is a command-line utility that helps you create Zip archives.
How to Zip or Unzip Files From the Linux Terminal
- https://www.howtogeek.com/414082/how-to-zip-or-unzip-files-from-the-linux-terminal/
- May 28, 2019 · To extract the files from a ZIP file, use the unzip command, and provide the name of the ZIP file. Note that you do need to provide the “.zip” extension. unzip source_code.zip. As the files are extracted they are listed to the terminal window. ZIP files don’t carry details of file ownership.
- https://www.cyberciti.biz/faq/unix-linux-redirect-error-output-to-null-command/
- Jun 05, 2014 · What is a null (/dev/null) file in a Linux or Unix-like systems? /dev/null is nothing but a special file that discards all data written to it. The length of the null device is always zero. In this example, first, send output of date command to the screen and later to …
Zip Error Nothing To Do Linux Fixes & Solutions
We are confident that the above descriptions of Zip Error Nothing To Do Linux and how to fix it will be useful to you. If you have another solution to Zip Error Nothing To Do Linux or some notes on the existing ways to solve it, then please drop us an email.
Источник
zipimport.ZipImportError: can’t decompress data; zlib not available
On RHEL 6.6, I installed Python 3.5.1 from source. I am trying to install pip3 via get-pip.py, but I get
It works for the Python 2.6.6 installed. I have looked online for answers, but I cannot seem to find any that works for me.
edit: yum search zlib
6 Answers 6
Ubuntu 16.10+ and Python 3.7 dev
Note: I only put this here because it was the top search result for the error, but this resolved my issue.
Update: also the case for ubuntu 14.04LTS and base kernel at 4.1+
The solution is : # yum install zlib-devel
Simply copy paste this code:
Throwing my 2cents. I’ve been dealing with this issue for the past 3 hours and realized that python3.6 for me was installed was in /usr/local/bin/.
Installing collected packages: setuptools, pip Successfully installed pip-9.0.1 setuptools-28.8.0
Updated Answer
first check if its installed
yum list python-gzipstream
If not then run the below to install
yum install python-gzipstream.noarch
I have this installed on my system
The zlib module is an optional feature for python and it seems that the version of python3.5 in RHEL 6.6 does not include it. You can verify this:
Not the answer you’re looking for? Browse other questions tagged rhel python pip python3 or ask your own question.
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.10.15.40479
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
Zipping and Unzipping Files under Linux
Asked by Yamir via e-mail
Question: MS-Windows has winzip program. I cannot find anything under Application menu to zip or unzip files on Linux. I am using Debian Linux. How do I zip and unzip file under Linux operating systems?
Answer: Linux has both zip and unzip program. By default, these utilities are not installed. You can install zip/unzip tools from the shell prompt. Open the Terminal by clicking on Application > System Tools > Terminal. You must be a root user, Type the following two commands to install zip and unzip program on Debian or Ubuntu Linux:
OR
$ sudo apt-get install zip unzip
If you are Red Hat Linux/Fedora/CentOS Linux user then you can use the yum command to install zip and unzip program as follows:
ziping files/directories examples
Creates the archive data.zip and puts all the files in the current directory in it in compressed form, type:
unziping files/directories examples
To use unzip to extract all files of the archive pics.zip into the current directory & subdirectories:
You can also test pics.zip, printing only a summary message indicating whether the archive is OK or not:
To extract the file called cv.doc from pics.zip:
To extract all files into the /tmp directory:
To list all files from pics.zip:
Linux GUI packages
You can use the following graphics packages
(1) KDE Desktop: Ark is an Archive Manager for the KDE Desktop. You can start Ark from Application > Accessories.
(2)GNOME Desktop: File Roller ia an Archive Manager for the GNOME Desktop.
See also
For more information please consult the following resources:
Источник
Error: Nothing to do trying to install local RPM
I’m trying to install this RPM locally via yum and am greeted with just a «Error: Nothing to do» message.
I’m at a loss for even the right question to ask at this point. How can I identify the problem and get this installed?
6 Answers 6
You should be using the rpm command to install, and including the full URL to the RPM.
Example (assuming install from the website in question and no other dependencies):
It’s probably not wise to just remove this without finding out why it’s there but, in my case, it was a holdover from the past and removing it solved the problem.
You can install/activate the percona repo with
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
Now you can use yum install Percona-Server-server-56-5.6.22-rel71.0.el6.x86_64.rpm to install the wanted package (and keep it up2date with yum)
If YUM is refusing to install a package it is probably because:
Yum will normally give some good guidance on what the problem is, if there is one, but sometimes it will return «Nothing to do»!
If the package is not installed already, or a lower version is installed, then you should normally be able to install or update.
When creating a RPM a spec file lists which packages and versions are required for the package to be installed. Reading this ‘spec’ file is the best way to fully understand what is required and to do so you will normally have to find the source RPM aka SRPM.
CentOS provide some great guidance on rebuilding a SRPM in order to inspect or customize it: Rebuild a Source RPM
I am guessing that when YUM returns Error: Nothing to do the Epoch number is the issue.
Источник