All pastes #214568 Raw Edit

backup script :)

public text v1 · immutable
#214568 ·published 2006-10-22 02:34 UTC
rendered paste body
#!/usr/bin/python
#program: backup_v1.py

import os
import time

def newline():
	print '\n'

# source directorys are defined in a list
source = ['/home/seth/Python', '/home/seth/ygyde']

# target destination for the backup
destination = '/home/seth/Desktop/'

# the files are backed up as a ZIP archive, the name is current date
# and time in Year Month Day Hour Minute Second

target = destination + time.strftime('%Y%m%d%H%M%S') + '.zip'

zip_command = " zip -qr '%s' %s" % (target, ' '.join(source))

#run the backup

if os.system(zip_command) == 0:
	print 'backup successful, placed in', target
else:
	print 'Failed'