作者SunnyStar (桑尼)
看板Python
标题[问题] 执行'将档案压缩'的script
时间Tue Sep 4 22:37:06 2007
各位大大好, 不好意思小弟又来发问了
我照着a byte of python上的教学在学python
今天遇到了一个问题, 先直接供上程式码
------------------------------------------------------------------------------
#!/usr/bin/python
# Filename: backup_ver1.py
import os
import time
source = 'C:\\mp3s'
target_dir = 'D:\\work\\'
target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip'
rar_command = "rar a'%s' %s" % (target, source)
if os.system(rar_command) == 0:
print 'Successful backup to', target
else:
print 'Backup FAILED'
------------------------------------------------------------------------------
当然, 不幸的, 执行後出现的是 'Backup FAILED'...
其实教学里是以Linux为范例, 而我的OS 是XP
所以我改了一些地方, 但我的OS 基础很差
不知道档案夹路径 跟 rar指令是否下错了
请大大们给我一些指点, 万分感谢,谢谢..
ps: a byte of python电子书之前有繁体中文的版本'咬一口python'
但我还没存下来该网站就挂掉了.. 真是苦了我
再次感谢各位大大了!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.192.157.234