Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FTP from Clipper

152 views
Skip to first unread message

Agnes Janssens

unread,
Jun 5, 2004, 6:51:28 AM6/5/04
to
Hi all,

Does anyone know how to up- and download file(s) to/from
an FTP-server from a Clipper 5.2 application ?

Any help much appreciated...


Bop Sprengers
Antwerp, Belgium


Pritpal Bedi

unread,
Jun 5, 2004, 7:39:47 AM6/5/04
to
Agnes Janssens

> Does anyone know how to up- and download file(s) to/from
> an FTP-server from a Clipper 5.2 application ?

Try V32Ftp() function off Vouch32.lib, it is free.

Regards

Pritpal Bedi | a student of software analysis and design
http://www.vouchcac.com | Vouch, the software that grows with you
http://www.vouchcac.com/vouch32/vouch32.htm | A Free Windows Extended
Utilities library for Clipper, Xbase++ & xHarbour
http://www.vouch.ws/Vouch32 | Vouch32.lib Support Web-Board


MNo

unread,
Jun 6, 2004, 2:04:31 PM6/6/04
to
With a script file like this :

nHandle := FCREATE( '$inst.ftp, 0)
FWrite( nHandle, 'open '+sIp+chr(13)+chr(10))
FWrite(nHandle,sLogin+chr(13)+chr(10))
FWrite(nHandle,sPassWord+chr(13)+chr(10))
FWrite(nHandle,'bin'+chr(13)+chr(10))
FWrite(nHandle,'get '+sFilename+chr(13)+chr(10)) //or to upload :
FWrite(nHandle,'put '+sFilename+chr(13)+chr(10))
FWrite(nHandle,'quit'+chr(13)+chr(10))
FClose(nHandle)
Overlay( 'ftp -s:$instg.ftp',0,'c:\TEMP')

sIP, sLogin, sPassWord and sFilename are variables :
sIP contains an IP address, sLogin contains your login, sPassWord contains
your password and sFilename contains the file name you want to get.

I use overlay.lib to execute external command or program, but you can do it
with the Clipper command RUN or with the Blinker SWPRUNCMD.
Example : SWPRUNCMD('ftp -s:$instg.ftp').

If you want to do a LS command : 'ftp -s:$instg.ftp > $dir.ftp' and parse
the result in $dir.ftp

"Agnes Janssens" <bop.sp...@busmail.net> wrote in message
news:40c1a5b1$0$306$a0ce...@news.skynet.be...

Charles Foot

unread,
Jun 6, 2004, 6:57:10 PM6/6/04
to
Hi Agnes,
under Win98SE and C5.3 I do this:

Handle = Fcreate( 'control' )
FWrite( HANDLE, 'my_username' + Chr( 13 ) + Chr( 10 ) )
FWrite( HANDLE, 'my_password' + Chr( 13 ) + Chr( 10 ) )
FWrite( HANDLE, 'binary' + Chr( 13 ) + Chr( 10 ) )// I switch to binary
for transferring zip files
FWrite( HANDLE, 'hash' + Chr( 13 ) + Chr( 10 ) )// gives a progress bar
FWrite( HANDLE, 'cd my_directory' + Chr( 13 ) + Chr( 10 ) )
FWrite( HANDLE, 'put my_file' + Chr( 13 ) + Chr( 10 ) )
FWrite( HANDLE, 'disconnect' + Chr( 13 ) + Chr( 10 ) )
FWrite( HANDLE, 'bye' + Chr( 13 ) + Chr( 10 ) )
FClose( HANDLE )

TASK = 'ftp -s:control my_website>lastupload' //the ">upload" writes the
progress to a file for later review
!&TASK

I enclose the whole in a loop and parse the "upload" file so that, in
the case of an error code, the process will repeat until successful.

ftp.exe is included with win98SE, and I assume, later versions

Greetings from Great Barrier Island, New Zealand
Charles

Joe Wright

unread,
Jun 6, 2004, 8:25:26 PM6/6/04
to

now := dtos(date())

tzip := 'dds' + right(now,4) + '.zip' // The filename to 'put'.

set alter to tzip.ftp // The script file
set console off
set alter on
?? "jwright"
? "dd1s68"
? "binary"
? "cd dir.one"
? "put &tzip"
? "cd ../dir.two"
? "put &tzip"
? "bye"
?
set alter off
set alter to
tim := "Start FTP "+dtoc(date())+" "+time()
! ("echo &tim >> ftp.log")
! ftp -s:tzip.ftp 199.16.5.2 >> ftp.log
tim := "End "+time()
! ("echo &tim >> ftp.log")
! ("echo --------------------------------- >> ftp.log")


--
Joe Wright mailto:joeww...@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---

0 new messages