Volkmaniac
Technical User
I've been using the following code I got from the website for zipping a file. I tried modifying it to do an unzip and I'm not having much luck. I'm assuming that the "-c" in the command line has to be changed to "-o". I've been having trouble getting it to recognize the Target/Source paths. I've also been having trouble with filters. If I manually delete a filter from a site I setup it keeps returning when I run a script. I know this is a bit long but I wanted to know if the ftp process was the cause of the problem.
proc main
string sPWZipPath, sCmdLine, sZipName, sTargetPath, sTargetFile, sSourcePath, sSourceMask, sTemp, sTemp2
string sDirectory,sLocal,sRec,sSnt
integer iRunTaskID, szDay, szMonth, szYear, szHour, szMin, szSec
ltimeints $LTIME szYear szMonth szDay szHour szMin szSec
strfmt sDirectory "%02d%02d" szMonth szDay
strfmt sLocal "S:\Client Services\FASTDATA\%s" sDirectory
strfmt sRec "%s\rec" sLocal
strfmt sSnt "%s\snt" sLocal
mkdir sRec ;Create a directory for retrieval
pause 5
mkdir sSnt ;Create the sent directory
pause 5
sendvkey 0x74
pause 5
Connect FTP "Fastdata-2I" ;Connect to our FTP site.
while $ftpstatus ;Loop while connecting to FTP site.
yield
endwhile
pause 1 ;Let Procomm update its screen.
FTP LOCAL CHDIR sRec
pause 1
sendvkey 0x74
set ftp filter local ""
set ftp filter remote ""
pause 5
set ftp xfermode BINARY
FTP REMOTE CHDIR "/RFIIAR2I" ;Change dir on FTP site.
set ftp filter remote ""
pause 1
sendvkey 0x74
pause 5
set ftp xfermode BINARY
sendvkey 0x74
pause 3
sendvkey 0x74
pause 2
ftp remote filelist "S:\Client Services\FASTDATA\fastdata_A.txt" ;create directory file listing
strfmt sTargetFile "RFIIXXX.ZIP"
sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Set up the paths
sTargetPath = sRec ;Path to unzip file
sSourcePath = sRec
sSourceMask = "RFII*.ZIP" ;Filter to use when searching for source files
shortpath sSourcePath sTemp
shortpath sTargetPath sTemp2
addfilename sPWZipPath sZipName ;Build execute statement
strfmt sCmdLine "%s %s%s`x01 %s\%s `x01 -o" sPWZipPath sTemp2, sTargetFile, sTemp, sSourceMask
run sCmdLine iRunTaskID ;Run PWZIP
pause 5
while taskexists iRunTaskID ;Wait for PWZIP to finish
yield
endwhile
proc main
string sPWZipPath, sCmdLine, sZipName, sTargetPath, sTargetFile, sSourcePath, sSourceMask, sTemp, sTemp2
string sDirectory,sLocal,sRec,sSnt
integer iRunTaskID, szDay, szMonth, szYear, szHour, szMin, szSec
ltimeints $LTIME szYear szMonth szDay szHour szMin szSec
strfmt sDirectory "%02d%02d" szMonth szDay
strfmt sLocal "S:\Client Services\FASTDATA\%s" sDirectory
strfmt sRec "%s\rec" sLocal
strfmt sSnt "%s\snt" sLocal
mkdir sRec ;Create a directory for retrieval
pause 5
mkdir sSnt ;Create the sent directory
pause 5
sendvkey 0x74
pause 5
Connect FTP "Fastdata-2I" ;Connect to our FTP site.
while $ftpstatus ;Loop while connecting to FTP site.
yield
endwhile
pause 1 ;Let Procomm update its screen.
FTP LOCAL CHDIR sRec
pause 1
sendvkey 0x74
set ftp filter local ""
set ftp filter remote ""
pause 5
set ftp xfermode BINARY
FTP REMOTE CHDIR "/RFIIAR2I" ;Change dir on FTP site.
set ftp filter remote ""
pause 1
sendvkey 0x74
pause 5
set ftp xfermode BINARY
sendvkey 0x74
pause 3
sendvkey 0x74
pause 2
ftp remote filelist "S:\Client Services\FASTDATA\fastdata_A.txt" ;create directory file listing
strfmt sTargetFile "RFIIXXX.ZIP"
sZipName = "PWZIP.EXE"
sPWZipPath = $PWTASKPATH ;Set up the paths
sTargetPath = sRec ;Path to unzip file
sSourcePath = sRec
sSourceMask = "RFII*.ZIP" ;Filter to use when searching for source files
shortpath sSourcePath sTemp
shortpath sTargetPath sTemp2
addfilename sPWZipPath sZipName ;Build execute statement
strfmt sCmdLine "%s %s%s`x01 %s\%s `x01 -o" sPWZipPath sTemp2, sTargetFile, sTemp, sSourceMask
run sCmdLine iRunTaskID ;Run PWZIP
pause 5
while taskexists iRunTaskID ;Wait for PWZIP to finish
yield
endwhile