R
R
reeegry2019-09-10 19:12:58
Python
reeegry, 2019-09-10 19:12:58

Why doesn't zip work?

Now I'm reading the book A Byte Of Python, it had this code that should create backup files, but this error occurs

zip error: Nothing to do! (try: zip -qr E:\Backup\201909102051S.zip . -i E:or_copy 'E:or copy')
Backup failed

copied exactly from workbook

import os
import time

# 1. Файлы и каталоги, который необходимо скопировать, собираются в список.
source = ["E:\\for_copy", "'E:\\for copy'"]

target_dir = "E:\\Backup"

target = target_dir + os.sep + time.strftime("%Y%m%d%H%M%S") + ".zip"

zip_command = "zip -qr {0} {1}".format(target, " ".join(source))

if os.system(zip_command) == 0:
    print("Резервная копия создана успешно в", target)
else:
    print("Создание резевной копии не удалось")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2019-09-10
@reeegry

Because there is no console utility in Windows. zip
Here is the answer to your question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question