if(widgetStylesPrinted != true) {document.write('');}var widgetStylesPrinted = true;var content = '
Original
python
  1. #!/usr/bin/python
  2. # Filename: backup_ver1.py
  3. import os
  4. import time
  5. # 1. The files and directories to be backed up are specified in a list.
  6. source = ['"C:\\\\My Documents"', 'C:\\\\Code']
  7. # Notice we had to use double quotes inside the string for names with
  8. spaces in it.
  9. # 2. The backup must be stored in a main backup directory
  10. target_dir = 'E:\\\\Backup' # Remember to change this to what you will be
  11. using
  12. # 3. The files are backed up into a zip file.
  13. # 4. The name of the zip archive is the current date and time
  14. target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'
  15. # 5. We use the zip command to put the files in a zip archive
  16. zip_command = "zip -qr {0} {1}".format(target, ' '.join(source))
  17. # Run the backup
  18. if os.system(zip_command) == 0:
  19. print('Successful backup to', target)
  20. else:
  21. print('Backup FAILED')
';document.write(content);