Ftp doubt

Ftp doubt

Postby Wanderson » Fri Mar 30, 2012 7:23 pm

Hi, i use aFiles = oFTP:Directory( "*.*" ) to list all files in a ftp, but i want to change the folder before do this, how?
Thanks.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Ftp doubt

Postby anserkk » Sat Mar 31, 2012 4:02 am

To change the folder
Code: Select all  Expand view
oFtp:SetCurrentDirectory( cDirName )


To get the list of files in a particular folder, you can also use
Code: Select all  Expand view
oFtp:Directory("/myDir/MyFiles/*.*")


Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Ftp doubt

Postby Wanderson » Wed May 02, 2012 11:49 am

Thanks Anser, but i have a big problem, i use this to connect a ftp:

oInternet := TInternet():New()
oFTP := TFTP():New( "ftp.orgfree.com", oInternet, "user", "passw" )
IF Empty( oFtp:hFtp)
MsgAlert("Não foi possível conectar ao FTP","Atenção")
Return .f.
Endif

aFiles = oFTP:Directory( "*.*" )

In some customers runs fine and aFiles returns all files in ftp, others customers aFiles returns empty, i can't see the problem.
Can you help me?

Thanks in advance.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Ftp doubt

Postby Richard Chidiak » Wed May 02, 2012 1:02 pm

Wanderson

As Anser suggested, you need to specify the complete path for the directory

oFtp:Directory("/myDir/MyFiles/*.*")

Some servers are Linux, others are windows and they will not respond without the complete path

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Ftp doubt

Postby Enrrique Vertiz » Wed May 02, 2012 6:29 pm

Wanderson

I have a same problem, the problem is "FTP Passive Mode", this mode not return list

Yo tengo el mismo problema con algunos FTPs y es porque estos necesitan conectarse con "Passive mode" y este modo no retorna nada cuando usamos "oFTP:Directory", por ahi creo que esta el problema
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 24.09, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Enrrique Vertiz
 
Posts: 541
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: Ftp doubt

Postby Wanderson » Wed May 02, 2012 6:42 pm

Richard Chidiak wrote:Wanderson

As Anser suggested, you need to specify the complete path for the directory

oFtp:Directory("/myDir/MyFiles/*.*")

Some servers are Linux, others are windows and they will not respond without the complete path

Hth

Richard


Richard thanks for your answer but the ftp server is the same, i just use ftp.orgfree.com. In somes costumers returns a complete array with files and others costumers don't.
I have no idea about this.

Thanks.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 111 guests