FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FTP Directory Method
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
FTP Directory Method
Posted: Thu Aug 08, 2019 09:29 PM

All,

I am attempting to build a program that downloads 1 to many ftp files from a secure ftp site, parse the data (csv), then insert into a dbf.
I have not used the FTP class in quite some time but I am attempting to write a sample program to just connect and present me with a directory.

I am going to speedtest.tele2.net

If I use the browser I get:

02/19/2016 12:00AM 73,741,824,000 1000GB.zip
02/19/2016 12:00AM 07,374,182,400 100GB.zip
02/19/2016 12:00AM 102,400 100KB.zip
02/19/2016 12:00AM 104,857,600 100MB.zip
02/19/2016 12:00AM 10,737,418,240 10GB.zip
02/19/2016 12:00AM 10,485,760 10MB.zip
02/19/2016 12:00AM 1,073,741,824 1GB.zip
02/19/2016 12:00AM 1,024 1KB.zip
02/19/2016 12:00AM 1,048,576 1MB.zip
02/19/2016 12:00AM 209,715,200 200MB.zip
02/19/2016 12:00AM 20,971,520 20MB.zip
02/19/2016 12:00AM 2,097,152 2MB.zip
02/19/2016 12:00AM 3,145,728 3MB.zip
02/19/2016 12:00AM 524,288,000 500MB.zip
02/19/2016 12:00AM 52,428,800 50MB.zip
02/19/2016 12:00AM 524,288 512KB.zip
02/19/2016 12:00AM 5,242,880 5MB.zip
08/08/2019 10:20PM Directory upload

Displays 17 files and 1 directory.

However when using the TFtp class the directory method returns an array 2 dimension but empty.
Is there a different version of this class that should be used?

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: FTP Directory Method
Posted: Sat Aug 10, 2019 08:15 PM

Has anybody had any luck with the tFtp class, I could just be doing something wrong.
Below is code from samples. The site I can connect from my browser fine.

Function TestFtpDir()
local oInternet := TInternet():New()
local oFtp := TFtp():New( "speedtest.tele2.net", oInternet,"anonymous" )
local aFiles
if !Empty( oFtp:hFTP )
aFiles := oFtp:Directory( "." )
MsgInfo( Len(aFiles),"aFiles" )
AEval( aFiles, { | aFile | MsgInfo( aFile[ 4 ], aFile[ 3 ] ) } )
else
MsgAlert( "oFtp:hFtp is null...","Connection not established." )
endif
oInternet:End()
MsgInfo( "Done!" )
return nil

Thank you,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: FTP Directory Method
Posted: Sat Aug 10, 2019 09:40 PM

Your sample worked just fine here.

EMG

Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: FTP Directory Method
Posted: Sat Aug 10, 2019 09:53 PM

Thank you, what was the size of aFiles when you ran it?

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: FTP Directory Method
Posted: Sat Aug 10, 2019 09:59 PM

Please note that I had to allow my test.exe in Windows Firewall.

EMG

Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: FTP Directory Method
Posted: Sat Aug 10, 2019 10:08 PM

Noted, Good advice, I will check into that.

Thanks,

Thanks,

Byron Hopp

Matrix Computer Services

Continue the discussion