Thank you and I will look into shutils, below is the code that did work:
import gzip
import os
MainFolder=r"E:/data"
for (path, dirs, files) in os.walk(MainFolder):
for dir in dirs:
print dir
path=path+'/'
for gzfiles in files:
if gzfiles[-3:]=='.gz':
pri
questions anon, 08.08.2011 01:57:
Thank you, I didn't realise that was all I needed.
Moving on to the next problem:
I would like to loop through a number of directories and decompress each
*.gz file and leave them in the same folder but the code I have written only
seems to focus on the last fold
Thank you, I didn't realise that was all I needed.
Moving on to the next problem:
I would like to loop through a number of directories and decompress each
*.gz file and leave them in the same folder but the code I have written only
seems to focus on the last folder. Not sure where I have gone wrong
On 7 August 2011 01:52, questions anon wrote:
> How can I output the decompressed file? something like:
> output=file_content.write(filepath[:-3])
>
>
See here:
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files
And here:
http://docs.python.org/library/stdtypes.html#file.w
Hi All,
I am trying to decompress at gzipped netcdf file and place the decompressed
file in the same folder without the *.gz extension. I am using gzip. If I
use the following code nothing happens.
import gzip
filepath="D:/test/surfacetemp.nc.gz"
compresseddata=gzip.open(filepath, "rb")
file_conte
you're using the '-q' and '-r' options of the
> 'zip'
> > > > command line utility. '-q' stands for 'quiet' mode, and although
> that's
> > > > nice when the command is working properly, it's not helpful when
> you're
> >
d is working properly, it's not helpful when
you're
> > > debugging a situation. Try turning quiet mode off, so that you have a
> > > better chance of getting good error output from the zip command. Even
> > > better, try enabling verbose mode, so you can see
on. Try turning quiet mode off, so that you have a
> > better chance of getting good error output from the zip command. Even
> > better, try enabling verbose mode, so you can see better what 'zip' is
> > attempting to do.
> >
> > Do you see anything else when you execute the prog
ry enabling verbose mode, so you can see better what 'zip' is
> attempting to do.
>
> Do you see anything else when you execute the program? Does anything else
> come out of standard error?
>
> Good luck to you.
>
> -- Forwarded message --
> Date:
at 'zip' is
attempting to do.
Do you see anything else when you execute the program? Does anything else
come out of standard error?
Good luck to you.
-- Forwarded message --
Date: Fri, 3 Dec 2004 10:24:15 +0600
From: Ramkumar Parimal Alagan <[EMAIL PROTEC
10 matches
Mail list logo