Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Tim N. van der Leeuw
Using gzip means you can compress only 1 file per gzip; so you'll have to invent something like tar to put all your files in your directories together into 1 file and then apply gzip on that file to get it compressed... Using the zipfile module should allow you to create a standard winzip-compatib

Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Tim N. van der Leeuw
Isn't it much easier to figure out how python built-in module 'zipfile' works? Pseudo-code would be something like: #UNTESTED import zipfile import os import os.path zf = zipfile.ZipFile('myzipfilename.zip', 'w', zipfile.ZIP_DEFLATED) for root, dirs, files in os.walk('compressthisdir'): for

Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Ravi Teja
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299412 -- http://mail.python.org/mailman/listinfo/python-list

Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Peter Hansen
sri2097 wrote: > Hi all,This is in reply to the 'Compressing folders in Windows using > Python' query I raised y'day. > > I figured out that windows does not allow command line zipping so I > started looking for alternatives. > > I found some modules in Perl which does zipping. I guess it goes by

Re.'Compressing folders in Windows using Python'

2006-01-02 Thread sri2097
Hi all,This is in reply to the 'Compressing folders in Windows using Python' query I raised y'day. I figured out that windows does not allow command line zipping so I started looking for alternatives. I found some modules in Perl which does zipping. I guess it goes by the name 'gzip'. I plan to w

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Tim N. van der Leeuw
Christian Tismer wrote: > sri2097 wrote: > > Hi, > > I'm trying to zip a particular fiolder and place the zipped folder into > > a target folder using python. I have used the following command in > > 'ubuntu'. > > > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > > > I execute

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Christian Tismer
sri2097 wrote: > Hi, > I'm trying to zip a particular fiolder and place the zipped folder into > a target folder using python. I have used the following command in > 'ubuntu'. > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > I execute this using os.command(zip_command). It w

Re: Compressing folders in Windows using Python.

2006-01-01 Thread bren[at]gillatt.org
Heiko Wundram wrote: > Steven D'Aprano wrote: > >>>But when I run this script in Windows XP, I get an error while >>>executing the above zip command. >> >>Would you like to tell us what error you get? > > > I presume the error he's seeing is something along the line of: > > "zip: Bad command or

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Heiko Wundram
Heiko Wundram wrote: > That's basically because there is no commandline builtin for zipping up > files on Windows, and I don't know of WinZIP or any of the InfoZIP derived > GUIs installing a command-line zipper. btw. the zip command isn't builtin on Unix either. It's only available if you install

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Heiko Wundram
Steven D'Aprano wrote: >> But when I run this script in Windows XP, I get an error while >> executing the above zip command. > > Would you like to tell us what error you get? I presume the error he's seeing is something along the line of: "zip: Bad command or filename." That's basically because

Re: Compressing folders in Windows using Python.

2006-01-01 Thread Steven D'Aprano
On Sun, 01 Jan 2006 04:07:11 -0800, sri2097 wrote: > Hi, > I'm trying to zip a particular fiolder and place the zipped folder into > a target folder using python. I have used the following command in > 'ubuntu'. > > zip_command = 'zip -qr %s %s' % (target, ' '.join(source)) > > I execute thi