import os, time # specifies the files to be backed up in a list source = ['/home/surgy'] # the directory to save the backup target_directory = '/storage/backup' #the backup is stored as a zip file with the current date as its name target = target_directory + time.strftime ('%Y%m%d_%H%M%S') + '.zip' #put the backup into a zip archive zip_command = "zip -qr %s' %s" % (target, " ".join(source)) print zip_command #run the backupt if os.system(zip_command) == 0: print "congratulations, you have succesfully made a backup to ", target else: print "BACKUP FAILED!!!!"