if(widgetStylesPrinted != true) {document.write('');}var widgetStylesPrinted = true;var content = '
Backup
python
  1. import os
  2. import time
  3.  
  4. source = 'F:\\\\PJ\\PythonPJ'
  5.  
  6. target_dir = 'F:\\\\PJ\\backup'
  7.  
  8. target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'
  9.  
  10. zip_command = "zip -qr".format(target, ' '.join(source))
  11.  
  12. if os.system(zip_command) == 0:
  13. print('Successful backup to', target)
  14. else:
  15. print('Backup FAILED')
';document.write(content);