> > Hi Sean,
> >
[quoted text clipped - 13 lines]
>
> Sean
I do not have a stand alone sample code, sory.
I use two options only:
1. List the compressed file attributes.
2. Decompress the gzip file.
And here is how the Shell() command looks for each of these cases:
1. C:\WINNT\system32\cmd.exe /C D:\0000\gzip.exe -lv D:\0000\Test1.txt.gz >
D:\0000\Out.txt
2. C:\WINNT\system32\cmd.exe /C D:\0000\gzip.exe -dvf D:\0000\Test1.txt.gz >
D:\0000\Out.txt
In the above commands /C after the cmd.exe means for the Command promtp
window to close automatically after the program finishes.
> D:\0000\Out.txt redirects the gzip.exe program output to a text file, so
my program can read it.
Also, do not hardcode the path and name of the Command prompt EXE, if you
run your program on different platforms.
Use Environ$("Comspec") to get the correct path and name to the Command
prompt.
Since Shell() starts the program asynchronously, if you want to wait until
it has finished, check this link fo how it is done:
http://groups.google.com/group/comp.lang.basic.visual.misc/browse_frm/thread/a53
f05064dda5044/2585ddd6918270a3?lnk=st&q=Re%3A+SHELL+stoil&rnum=5&hl=en#2585ddd69
18270a3
There are two essential things to note:
- each .GZ archive containes only one file;
- when the file is decompressed, the original .GZ file is replaced by
the decompressed one which is renamed with the same name minus the .GZ
extension.
Taking the above into account, if you need to extract the .GZ file in
certain directory, you must first copy the .GZ file in that directory and
then extract it. Or you can extract it in whatever directory it is currently
and then copy the extracted file into the directory you need it to be.
There is no way for you to specify a directory where the extracted file
would go as you could with the unzip.exe utility.
Hope this helps.
Regards,
Stoil