不是将由C:/ Users / User / Desktop / Folder制作的zip文件保存为ZipFile.zip/Folder,而是将zip文件保存为ZipFile.zip/Users/User/Desktop/Folder
下面使用的Python变量:
以下代码:
backUp = raw_input("> ")
backDevice = raw_input("> ")
backZip = raw_input("> ")
dest = backDevice + "/BackUp"
bkZip = zipfile.ZipFile(os.path.join(dest, backZip), 'w')
for dirname, subdirs, files in os.walk(backUp):
bkZip.write(dirname)
for filename in files:
bkZip.write(os.path.join(dirname, filename))
bkZip.close()