[Tutor] Hi, need help on zip commands for windows

Senthil_OR at Dell.com Senthil_OR at Dell.com
Thu Jul 13 07:14:07 CEST 2006


There is no zip command in as such in windows. You can install
www.7-zip.com software and trying withh command command line interface
as belodw
zip_command = "7z -a %s %s" % (target, ''.join(source))
 
If you like to zip files using python:
 
import zipfile
#create a zip
zipf = zipfile.ZipFile('myzipfile.zip','w',zipfile.ZIP_DEFLATED)
for path,dirs,files in os.walk('Directory_To_Zip'):
    for filen in files:
        filen = os.path.join(path,filen)
        print filen,'...'
        zipf.write(filen)
print 'done'
zipf.close()
 
-- 
Senthil
 


________________________________

From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of Ramakrishnan, Shashikanth
Sent: Thursday, July 13, 2006 3:08 AM
To: tutor at python.org
Subject: [Tutor] Hi, need help on zip commands for windows



Hi,

I have just started using Python and would appreciate if somebody could
help me out on zip commands.

I am using C H Swaroop's book "A byte of python" as my beginners guide.

 

One example states to use >>>zip_command = "zip -qr '%s' %s" % (target,
' '.join(source))

for zipping the target and source.

However, "zip_command" as I understand is for Linux.

 

What would be the quivalent command for windows( I am using IDLE 1.1.3,
Python version 2.4.3)

 

Really appreciate your help.

 

Thanks,

Shashi.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060713/21576b33/attachment.htm 


More information about the Tutor mailing list