FTP Directory Method

FTP Directory Method

Postby byron.hopp » Thu Aug 08, 2019 9: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
byron.hopp
 
Posts: 356
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: FTP Directory Method

Postby byron.hopp » Sat Aug 10, 2019 8: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
byron.hopp
 
Posts: 356
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: FTP Directory Method

Postby Enrico Maria Giordano » Sat Aug 10, 2019 9:40 pm

Your sample worked just fine here.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8372
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Directory Method

Postby byron.hopp » Sat Aug 10, 2019 9:53 pm

Thank you, what was the size of aFiles when you ran it?
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 356
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA


Re: FTP Directory Method

Postby Enrico Maria Giordano » Sat Aug 10, 2019 9:59 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8372
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: FTP Directory Method

Postby byron.hopp » Sat Aug 10, 2019 10:08 pm

Noted, Good advice, I will check into that.

Thanks,
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 356
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests