I found this tutorial in A Byte of Python, but do not understand it:
import os
import time
source = [r'C:\Users\Desktop\Stuff']
target_dir = 'C:\Users\Backup'
target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip'
zip_command = 'zip -qr "%s" %s' % (target, ' '.join(source))
if os.system(zip_command) == 0:
print 'Successful backup to', target
else:
print 'Backup failed!'
After checking help(os) I do not understand why os.system(zip_command) would ever be zero. .system() does not return a Boolean, does it?
thanks.