[Tutor] how to zip data?

Ramkumar Parimal Alagan ramster6 at gmail.com
Tue Nov 23 04:05:12 CET 2004

I am on windows XP,  new to Python.

i'm learning to take back up, i want to know how to zip the data.


import os
import time

source = ['d:\\down']

target_dir = 'd:\\'

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
    print 'Backup FAILED'


is the zip command rite??

More information about the Tutor mailing list