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!

UNZIP

Status
Not open for further replies.

Volkmaniac

Technical User
Mar 19, 2003
104
US
Doeas anyone have an example of an unzip script that actually works? I'm using directories with spaces so I'd need the shortpath command. I've tried the unzip from and it's not working. I tried to modify the zip script and that hasn't worked either.
 
The spaces in the path should not be an issue when unzipping. Here is the example I used from my site with the paths I used. The source and destination path both had spaces, as did the two filenames in the ZIP file I used.

proc main
string sPWZipPath, sCmdLine, sTargetPath, sZipName, sSourceFile
integer iRunTaskID

sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Setup the needed paths
sTargetPath = "e:\program files" ;Path to unzip ZIP contents to
sSourceFile = "c:\program files\test one.zip" ;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
while taskexists iRunTaskID ;Wait for PWZIP to finish
yield
endwhile
endproc

aspect@aspectscripting.com
 
Maybe there's something wrong with my pkzip. I used a test file from your script and this was my output:

C:\Program Files\Symantec\Procomm Plus\PROGRAMS\PWZIP.EXE c:\test.zip c:\ -o

proc main
string sPWZipPath, sCmdLine, sTargetPath, sZipName, sSourceFile
integer iRunTaskID

sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Setup the needed paths
sTargetPath = "c:\" ;Path to unzip ZIP contents to
sSourceFile = "c:\test.zip" ;Source ZIP file

addfilename sPWZipPath sZipName ;Build the execute statement
strfmt sCmdLine "%s %s`x01 %s`x01 -o" sPWZipPath sSourceFile sTargetPath
termmsg "%s" sCmdLine
run sCmdLine iRunTaskID ;Run PWZIP
while taskexists iRunTaskID ;Wait for PWZIP to finish
yield
endwhile
endproc
 
It worked! All I had to do was take the slash off the targetpath

sTargetPath = "c:" ;Path to unzip ZIP contents to
 
I'm sorry, I still had to use shortpath:

shortpath sSourceFile sTemp
shortpath sTargetPath sTemp2

Thanks again. That was starting to drive me crazy.
 
What OS are you running? This worked OK on my NT machine at work, but doesn't look to work on my Win98 machine (haven't had time to debug it further yet).


aspect@aspectscripting.com
 
I use NT as well. I'm just happy it's working. I'm running a script that downloads the file from our Unix box, unzips it, and then ftp's the file to a remote site. It's a pain doing it for multiple files so I'm really glad it's working.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top