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!

check file date before up/download to/from host.

Status
Not open for further replies.

zeroendless

Programmer
Mar 20, 2003
23
US
I have the client script to log in host(host script is one that comes with procomm plus). Then upload file to host if files on upload folder(client side) is current date. The folder could has more than 3 current date files.

Here's what i want to do. While uploading all current date files to host, i also need to download current date files from host ( could have more than 1 files). Is that a way to check files from host before downloading? The script provided is used to up/download only if the filename is know and no condition check on file date. The StartUpload module is used to call upload process.

any input is appreciated
----------------------------------------------------------
long Filedate
long lastDate
integer iStatus
string sFname

#define Step(a,b) transmit a # waitfor b

proc main
login()

if findfirst "C:\Program Files\Symantec\Procomm Plus\Upload\*.*"
sFname = $FILESPEC
Filedate = $FLTIME
lastDate = $LTIME - 86400

while findnext
if $FLTIME >= lastDate
Filedate = $FLTIME
sFname = $FILESPEC
StartUpload("u","z",sFname)
pause 5
endif
endwhile
endif

endproc

proc login
transmit "^M~~"
waitfor "Enter your FULL Name: "
transmit "test^M"
waitfor "Is this correct (Y/N)? "
transmit "y"
waitfor "Password: "
transmit "password^M"
endproc

proc StartDownload
param string Downchoice,Downprotocol,Downfilename
transmit "^M~~"
Step(Downchoice,"Your Choice? ")
Step(Downprotocol,"Your choice? ")
Step(Downfilename,"File name? ")
transmit "^M~~"
getfile ZMODEM
iStatus = $XFERSTATUS
while iStatus==1
yield
iStatus = $XFERSTATUS
endwhile

endproc


proc StartUpload
param string Upchoice,Upprotocol,Upfilename
transmit "^M~~"
Step(Upchoice,"Your Choice? ")
Step(Upprotocol,"Your choice? ")
Step(Upfilename,"File name? ")
transmit "^M~~"

sendfile ZMODEM Upfilename
iStatus = $XFERSTATUS
while iStatus == 1
iStatus = $XFERSTATUS
yield
endwhile

endproc
---------------------------------------------------
 
It's not possible to get a file's stats via the host script. However, since you are using Zmodem, you can use its crash recovery feature to determine what to do when a file you are trying to download already exists on the local system. To do so, select the Options | Data Options | Transfer Protocol menu item. Make sure that Zmodem is the current transfer protocol, then click on the Change Settings button associated with Receiver Crash Recovery Settings. I would recommend selecting If the CRCs match and Overwrite if incoming newer. This will let Zmodem crash recover (i.e. start download where a previous transfer failed if the connection was dropped, for instance) if the files are identical, otherwise the local file will be overwritten with the newer file from the host system.


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

Part and Inventory Search

Sponsor

Back
Top