全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 python论坛
770 1
2018-12-04
mac系统下的文件备份,为啥老是返回失败呢是需要像windows一样先安装什么东西吗

import os
import time

source=['/Users/F.Florent/origin']

target_dir='/Users/F.Florent/backup'

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

if not os.path.exists(target_dir):
    os.mkdir(target_dir)

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

print('Zip command is')
print(zip_command)
print('Running:')
if os.system(zip_command)==0:
    print('Successful backup to',target)
else:
    print('Backup FAILED')

下面是结果
Zip command is
zip-r/Users/F.Florent/backup/20181204155428.zip/Users/F.Florent/origin
Running:
Backup FAILED

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2018-12-4 16:19:37
忘添加悬赏了有老哥帮忙我等下重新发个悬赏贴给您
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群