- 帖子
- 36
- 精华
- 0
- 积分
- 127
- 阅读权限
- 20
- 注册时间
- 2016-10-18
- 最后登录
- 2016-11-23
|
crossin先生 发表于 2016-10-26 18:14
在你的文件夹按住shift点右键,选择在此处打开命令提示符,然后在里面运行这个命令,看看提示什么。
我觉 ...
我分别在以上文件夹右键在终端操作后,还是不行。。
这是那本书的源代码:
- #!/usr/bin/python
- # Filename: backup_ver1.py
- import os
- import time
- # 1. The files and directories to be backed up are specified in a list.
- source = ['/home/swaroop/byte', '/home/swaroop/bin']
- # If you are using Windows, use source = [r'C:\Documents', r'D:\Work'] or something like that
- # 2. The backup must be stored in a main backup directory
- target_dir = '/mnt/e/backup/' # Remember to change this to what you will be using
- # 3. The files are backed up into a zip file.
- # 4. The name of the zip archive is the current date and time
- target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip'
- # 5. We use the zip command (in Unix/Linux) to put the files in a zip archive
- zip_command = "zip -qr '%s' %s" % (target, ' '.join(source))
- # Run the backup
- if os.system(zip_command) == 0:
- print 'Successful backup to', target
- else:
- print 'Backup FAILED'
复制代码 我照着这个写的,不知道哪里出了问题。 |
|