Program for Backup - Python -


im trying execute following code in python 2.7 on windows7. purpose of code take specified folder specified folder per naming pattern given.

however, im not able work. output has been 'backup failed'.

please advise on how resolve code working.

thanks.

code :

backup_ver1.py  import os import time import sys  sys.path.append('c:\python27\gnuwin32\bin') source = 'c:\new' target_dir = 'e:\backup' target = target_dir + os.sep + time.strftime('%y%m%d%h%m%s') + '.zip' zip_command = "zip -qr {0} {1}".format(target,''.join(source)) print('this program backing files') print(zip_command)  if os.system(zip_command)==0: print('successful backup to', target) else: print('backup failed') 

see if escaping \'s helps :-

source = 'c:\\new' target_dir = 'e:\\backup' 

Comments

Popular posts from this blog

c++ - End of file on pipe magic during open -

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -