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!

$FILESPEC AND UNZIP

Status
Not open for further replies.

IncredibleVolk

Technical User
Apr 2, 2004
67
US
DOES $FILESPEC WORK WHEN YOU'RE TRYING TO UNZIP A FILE?
I DON'T UNDERSTAND WHY THIS FILE ISN'T UNZIPPING.

string FileSpec = "S:\Client Services\TRANSUNION\051804\*.ZIP"
integer iRunTaskID

sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH
sTargetPath = "S:\Client Services\TRANSUNION\051804"
statmsg "%s" sTargetPath
if findfirst FileSpec
strfmt sDos "%s" $filespec
sSourceFile = sDos
endif
pause 1
statmsg "%s" sSourceFile


shortpath sSourceFile sTemp
shortpath sTargetPath sTemp2

addfilename sPWZipPath sZipName
strfmt sCmdLine "%s %s`x01 %s`x01 -o" sPWZipPath sTemp sTemp2
usermsg "%s" sCmdLine
run sCmdLine iRunTaskID
while taskexists iRunTaskID
yield
endwhile
pause 5

endproc
 
I ran this script on both Win98 and Win2K and it worked fine. I did notice one problem with a second ZIP file that had path information stored in it, but haven't had time to track it down more than that. If you hard-code your ZIP file into the script instead of using $FILESPEC, does it unzip OK?


aspect@aspectscripting.com
 
I just noticed something. This is the filename to unzip

OLB[2].EDTOUT.ARSNTCDT.ZIP

C:\Program Files\Symantec\Procomm Plus\PROGRAMS\PWZIP.EXE S:\CLIENT~1\TRANSU~1\052104\OLB_2_~1.ZIP S:\CLIENT~1\TRANSU~1\052104 -o


It's translating [2] as _2_ Does that matter?
 
With shortpath:

C:\Program Files\Symantec\Procomm Plus\PROGRAMS\PWZIP.EXE S:\CLIENT~1\TRANSU~1\052104\OLB_2_~1.ZIP


Without using shortpath:

C:\Program Files\Symantec\Procomm Plus\PROGRAMS\PWZIP.EXE S:\Client Services\TRANSUNION\052104\OLB[2].EDTOUT.ARSNTCDT.ZIP

Is the shortpath causing it to misread the filename?
 
It does appear to be something in the shortpath command. However, in the tests I have run based on your script, I am getting output both with and without the shortpath command in the script. Are you not getting any output at all?


aspect@aspectscripting.com
 
Talked this over with another guy at work and if you do a DIR /X of the directory containing your file name, the 8.3 filename is as you mentioned so this appears to be Windows behavior and not something with the shortpath command itself.


aspect@aspectscripting.com
 
You're correct, it's the way the filename it appears in DOS. I can see the flash of pkzip come across the screen but it's not unzipping the file. The only that's different than any other script where I unzip files is the $filespec to obtain the name of the file. It probably has something to do with the brackets [2] in the filename.
 
I'm running Windows 2000. I've concluded it's not going to work and I'm going to explore using a Windows script host.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top