[Tutor] how to zip data?

orbitz orbitz at ezabel.com
Tue Nov 23 04:19:38 CET 2004


Doubtful, I don't think windows comes with any zip programs by default.  
python has a zipfile module, you should just use that.

http://docs.python.org/lib/module-zipfile.html

Ramkumar Parimal Alagan wrote:

>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
>else:
>    print 'Backup FAILED'
>
>
>++++++++++++++++++++
>
>is the zip command rite??
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>



More information about the Tutor mailing list