home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------
- * miniftp.cmd :
- *------------------------------------------------------------------*/
-
- trace off
-
- /*------------------------------------------------------------------
- * load functions, if needed
- *------------------------------------------------------------------*/
- if RxFuncQuery("FtpLoadFuncs") then
- do
- rc = RxFuncAdd("FtpLoadFuncs","RxFtp","FtpLoadFuncs")
- rc = FtpLoadFuncs()
- end
-
- if RxFuncQuery("SysLoadFuncs") then
- do
- rc = RxFuncAdd("SysLoadFuncs","RexxUtil","SysLoadFuncs")
- rc = SysLoadFuncs()
- end
-
- /*------------------------------------------------------------------
- * set up signal
- *------------------------------------------------------------------*/
- signal on halt
-
- /*------------------------------------------------------------------
- * get parameters
- *------------------------------------------------------------------*/
- parse arg user pass .
-
-
- /*------------------------------------------------------------------
- * set things
- *------------------------------------------------------------------*/
- SAY LOGON
-
- rc = FtpSetUser("hobbes.nmsu.edu",user,pass)
- if rc <> 1 then
- do
- say "Error logon" FTPERRNO
- call done
- end
-
- say CD
-
- rc = FtpChDir("/incoming")
- if rc <> 0 then
- do
- say "Error ChDir" FTPERRNO
- call done
- end
-
- CD incoming
-
- say LS
-
- rc = FtpDir("*.*", "stem.")
- if rc <> 0 then
- do
- say "Error Get" FTPERRNO
- call done
- end
-
- do i = 1 to stem.0
-
- PARSE VAR stem.i Attr Trash1 Trash2 Trash3 Size Month Day Time FileName
-
- PARSE UPPER VAR FileName UFileName
-
- if Trash2 = "ftp" then
- if RIGHT(UFileName, 3) = "TXT" then
- do
- /* A Desc file!!! */
- call SysFileTree UFileName, 'file', 'FO'
- if file.0 = 0 then
- call getfile(FileName)
- else
- say "* File exist " FileName
- end
- else
- NOP
- else
- NOP
-
- end
-
- del FILE.LST
-
- call LINEOUT 'FILE.LST', , 1
-
- do i = 1 to stem.0
-
- SAY stem.i
-
- PARSE VAR stem.i Attr Trash1 Trash2 Trash3 Size Month Day Time FileName
-
- PARSE UPPER VAR FileName UFileName
-
- if Trash2 = "ftp" then
- if RIGHT(UFileName, 3) <> "TXT" then
- do
- call LINEOUT 'FILE.LST', FileName Size Month Day Time
- end
-
- END
-
- call LINEOUT 'FILE.LST'
-
- say "OK"
-
- done:
- rc = FtpSetUser("X","X","X")
- rc = FtpLogoff()
-
- cd ..
-
- exit
-
- GetFile: procedure
- rc = FTPGet( arg(1) , arg(1), "ASCII")
- if rc <> 0 then say "* Error receiving " arg(1)
- else say "* Received " arg(1) " successfully"
- return