Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unziping files

Status
Not open for further replies.

dbsquared

Programmer
Nov 7, 2002
175
US
I have a situation where I will be FTPing files to my machine. The problem is the files are zipped and I need to unzip them and process the data in the file that is zipped. My question is there an easy way to unzip with procomm?

To go where no programmer has gone before.
 
You can use the PWZip executable that comes with Procomm. I have an example script or two on the samples page of my site that shows how to construct the command line.


aspect@aspectscripting.com
 
I can't seem to get the unzip script to work. It doesn't do anything when it gets to it. Here is the script so far.

proc unzip
param string tempstr ;passing the name of the zip file.

string sPWZipPath, sCmdLine, sTargetPath, sZipName, sSourceFile,tempstr2
integer iRunTaskID

sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Setup the needed paths
sTargetPath = "C:\Nortel Data\" ;Path to unzip ZIP contents to
strfmt tempstr2 "C:\Nortel Data\%s", tempstr
sSourceFile = tempstr2 ;Source ZIP file

addfilename sPWZipPath sZipName ;Build the execute statement
strfmt sCmdLine "%s %s`x01 %s`x01 -o" sPWZipPath sSourceFile sTargetPath

run sCmdLine iRunTaskID ;Run PWZIP
usermsg " I am unziping"

while taskexists iRunTaskID ;Wait for PWZIP to finish
usermsg " I am waiting"

yield
endwhile
usermsg " I am done"

endproc

the script runs to the usermsg's then just goes on, and the file is not unzipped anywhere.

Any help to see what I am missing would be appreciated.
Thanks

To go where no programmer has gone before.
 
I have changed it a little to try and unzip but it still doesn't work.

proc unzip
param string tempstr

string sPWZipPath, sCmdLine, sTargetPath, sZipName, sSourceFile
integer iRunTaskID
sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Setup the needed paths
sTargetPath ="C:\Nortel Data"
;sSourceFile = tempstr ;Source ZIP file
sSourceFile = "C:\Nortel Data\Atlanta 1 (Roswell 1)_Log.gz"
tempstr is the same as the above line.

addfilename sPWZipPath sZipName ;Build the execute statement
strfmt sCmdLine "%s %s`x01 %s`x01 -o" sPWZipPath sSourceFile sTargetPath

run sCmdLine iRunTaskID ;Run PWZIP

while taskexists iRunTaskID ;Wait for PWZIP to finish
yield
endwhile

endproc

The problem might be that this doesn't have a .zip extention?

Thanks

To go where no programmer has gone before.
 
I am not certain that .gz and .zip are the same format. I know that WinZip can handle .gz files, but I doubt that Procomm's zip utility can handle .gz files if indeed they are a different format. You could test this theory by unzipping a .zip file with your script and see if that works or not.


aspect@aspectscripting.com
 
I tested it and I can unzip a .zip file. Any ideas on how to unzip the .gz files, I have no choice in the format that the files are in.
Thanks

To go where no programmer has gone before.
 
Unfortunately, there is no way to do this with Procomm's zip utility, but you can likely find another DOS-based zip program that you could build a similar command line for and execute. I once wrote something like this for PKZip (I think) a few years ago.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top