python 在windows环境下 压缩文件
# coding=GBK __author__ = 'Administrator' import os import time sourcelist=['d:/share/findshell/plus/php_eval_assert.py','d:/share/findshell/tmp/__init__.py'] target_dir='d:/share/backup/' for source in sourcelist: target_name=source+time.strftime('%Y%m%d%H%M%S')+'.zip' zip_command="makecab "+source+" "+target_name #if (os.system('powershell -command '+zip_command)): if (os.system(zip_command).bit_length())==0: print("压缩成功") else:print("压缩失败!")
# coding=GBK
__author__ = 'Administrator'
import os
import time
sourcelist=['d:/share/findshell/plus/php_eval_assert.py','d:/share/findshell/tmp/__init__.py']
target_dir='d:/share/backup/'
for source in sourcelist:
target_name=source+time.strftime('%Y%m%d%H%M%S')+'.zip'
zip_command="makecab "+source+" "+target_name
#if (os.system('powershell -command '+zip_command)):
if (os.system(zip_command).bit_length())==0:
print("压缩成功")
else:print("压缩失败!")