Ê
Ê÷Éϲä»Ò
'rar' is not recognized as an internal or external command,
operable program or batch file.
import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source))
print rar_cmd
if os.system(r'cd D:\Program Files\WinRAR') == 0:
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'
else:
print 'FAILED!!!'
'rar' is not recognized as an internal or external command,
operable program or batch file.
rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains
Backup Failed!
but.........................
D:\>cd D:\Program Files\WinRAR
D:\Program Files\WinRAR>rar a -idcdp e:\temp\bak20060222191139.rar
e:\temp\code
e:\temp\domains
Creating archive e:\temp\bak20060222191139.rar
Adding e:\temp\Code\Code\.classpath OK
Adding e:\temp\Code\Code\.project OK
Adding e:\temp\Code\Code\common\Code.class OK
Adding e:\temp\Code\Code\common\Code.java OK
Adding e:\temp\Code\Code\common OK
Adding e:\temp\Code\Code OK
Adding e:\temp\Code OK
Adding e:\temp\domains\examples.jar OK
Adding e:\temp\domains\medrec.jar OK
Adding e:\temp\domains\wls.jar OK
Adding e:\temp\domains\wlw.jar OK
Adding e:\temp\domains OK
D:\Program Files\WinRAR>
why?
operable program or batch file.
import os
import time
source = [r'e:\temp\code',r'e:\temp\domains']
target_dir = r'e:\temp\bak'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar'
rar_cmd = "rar a -idcdp %s %s" % (target,' '.join(source))
print rar_cmd
if os.system(r'cd D:\Program Files\WinRAR') == 0:
if os.system(rar_cmd) == 0:
print 'Successful backup to',target
else:
print 'Backup Failed!'
else:
print 'FAILED!!!'
'rar' is not recognized as an internal or external command,
operable program or batch file.
rar a -idcdp e:\temp\bak20060222191139.rar e:\temp\code e:\temp\domains
Backup Failed!
but.........................
D:\>cd D:\Program Files\WinRAR
D:\Program Files\WinRAR>rar a -idcdp e:\temp\bak20060222191139.rar
e:\temp\code
e:\temp\domains
Creating archive e:\temp\bak20060222191139.rar
Adding e:\temp\Code\Code\.classpath OK
Adding e:\temp\Code\Code\.project OK
Adding e:\temp\Code\Code\common\Code.class OK
Adding e:\temp\Code\Code\common\Code.java OK
Adding e:\temp\Code\Code\common OK
Adding e:\temp\Code\Code OK
Adding e:\temp\Code OK
Adding e:\temp\domains\examples.jar OK
Adding e:\temp\domains\medrec.jar OK
Adding e:\temp\domains\wls.jar OK
Adding e:\temp\domains\wlw.jar OK
Adding e:\temp\domains OK
D:\Program Files\WinRAR>
why?