Volkmaniac
Technical User
here's a script that will grab the newest file in a specified directory and then ftp it from local to remote:
;****************************************************************************
;* Transfer *
;* This procedure will ftp the zipped batch file to ACT *
;****************************************************************************
proc Transfer
FTP LOCAL CHDIR "XXXX" ;Set the local dir.
while $ftpstatus ;Loop while connecting to FTP site.
yield
endwhile
pause 1 ;Let Procomm update its screen.
Connect FTP "XXXX" ;Connect to ACT FTP site.
FTP REMOTE CHDIR "XXXX" ;Change dir on FTP to remote site.
set ftp filter local "*.zip"
pause 1
sendvkey 0x74
pause 5
GetNewest()
FTP LOCAL COPYFILE fname ;Copy (download) * from FTP
;site to local machine. Filenames
;are case-sensitive!
while $ftpstatus ;Yield while transferring file.
yield
endwhile
pause 10
pwmode TERMINAL
disconnect
endproc
;****************************************************************************
;* GetNewest *
;* This procedure gets the latest file in the specified directory *
;* Calls: None *
;* Modifies Globals: fname *
;****************************************************************************
proc GetNewest
long Newest ;Maintain date/time for newest file found
Fname = "[ None ]" ;Default to [ None ] for name
if findfirst SearchString ;Find the first file
Newest = $FLTIME ;Get the first file's date/time info
Fname = $FILENAME ;Get the first file's name
while findnext ;Find the next file
if $FLTIME >= Newest ;Is this ones date/time newer?
Newest = $FLTIME ;Get the new file's date/time info
Fname = $FILENAME ;Get the new file's file name
endif
endwhile
endif
endproc
;****************************************************************************
;* Transfer *
;* This procedure will ftp the zipped batch file to ACT *
;****************************************************************************
proc Transfer
FTP LOCAL CHDIR "XXXX" ;Set the local dir.
while $ftpstatus ;Loop while connecting to FTP site.
yield
endwhile
pause 1 ;Let Procomm update its screen.
Connect FTP "XXXX" ;Connect to ACT FTP site.
FTP REMOTE CHDIR "XXXX" ;Change dir on FTP to remote site.
set ftp filter local "*.zip"
pause 1
sendvkey 0x74
pause 5
GetNewest()
FTP LOCAL COPYFILE fname ;Copy (download) * from FTP
;site to local machine. Filenames
;are case-sensitive!
while $ftpstatus ;Yield while transferring file.
yield
endwhile
pause 10
pwmode TERMINAL
disconnect
endproc
;****************************************************************************
;* GetNewest *
;* This procedure gets the latest file in the specified directory *
;* Calls: None *
;* Modifies Globals: fname *
;****************************************************************************
proc GetNewest
long Newest ;Maintain date/time for newest file found
Fname = "[ None ]" ;Default to [ None ] for name
if findfirst SearchString ;Find the first file
Newest = $FLTIME ;Get the first file's date/time info
Fname = $FILENAME ;Get the first file's name
while findnext ;Find the next file
if $FLTIME >= Newest ;Is this ones date/time newer?
Newest = $FLTIME ;Get the new file's date/time info
Fname = $FILENAME ;Get the new file's file name
endif
endwhile
endif
endproc