Script to back up files

The following example illustrates a simple script to back up files .
The backup files are zipped with a name corresponding to the current date and time

import os,sys,time
zip_command="zip -r %s %s" %(target,' '.join(source))
if (os.system(zip_command)==0):
	print 'successful backup to ',target
else :
	print 'Backup failed'

Please change the file names and the paths for the script to run

Concept and idea : borrowed from the book A Byte of Python by Swaroop C.H


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s