'rar' is not recognized as an internal or external command£¿£¿£¿£¿

Ê÷Éϲä»Ò zhangchao19 at hotmail.com
Thu Feb 23 22:36:08 EST 2006


thank everyone!!!

the code:

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 = "D:\\Progra~1\\WinRAR\\rar.exe a -idcdp %s %s" % (target,'
'.join(source))
print rar_cmd
if os.system(rar_cmd) == 0:
   print 'Successful backup to',target
else:
   print 'Backup Failed!'

thanks again!


-- 
Ê÷Éϲä»Ò
"Ê÷Éϲä»Ò" <zhangchao19 at hotmail.com> дÈëÓʼþ
news:dtjv4r$ma1$1 at news.cn99.com...
>
> '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?
>
>
>
>
> -- 
> Ê÷Éϲä»Ò
>
>





More information about the Python-list mailing list