Copy Code code as follows:
#!/usr/bin/env python
# Filename:backup_ver1.py
Import OS
Import time
# 1. The files and directories to is backed up are specified in a list.
#source =['/home/swaroop/byte ', '/home/swaroop/bin ']
source=[' d:\\filecopier\\*.* ', ' d:\\jeecms_doc\\*.* ']
# If You are are using Windows, use source=[r ' C:\Documents ', R ' D:\Work ' or something
# 2. The backup must is stored in a main backup directory
#target_dir = '/mnt/e/backup/' #Remember to the change this to what you are using
Target_dir= ' e:\\temp\\ ' #Remember to the change this to what you are 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)
zip_command= "rar a" + target + '. Join (source)
# Run The Backup
If Os.system (Zip_command) ==0:
print ' successful backup to ', target
Else
print ' Backup FAILED '