Hello,
Is there a possibility to get all file's available on a FTP-directory (like adir())?
A webapplication creates a file for each order done on the webstore.
Then my program have to copy all files via a FTP-connection from the server and import them.
Then all files should be deleted from the FTP-server.
Thanks,
Marc
Read directory on a FTP-connection
-
- Posts: 1102
- Joined: Mon Oct 17, 2005 5:41 am
- Location: Belgium
- Contact:
Read directory on a FTP-connection
Regards,
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Read directory on a FTP-connection
Marc,
There is a working example in FWH\samples\FtpDir.prg
There is a working example in FWH\samples\FtpDir.prg
Re: Read directory on a FTP-connection
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
-
- Posts: 1102
- Joined: Mon Oct 17, 2005 5:41 am
- Location: Belgium
- Contact:
Re: Read directory on a FTP-connection
Thanks Antonio an Otto,
That's exactly what I need.
Regards,
Marc
That's exactly what I need.
Regards,
Marc
Regards,
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
-
- Posts: 1102
- Joined: Mon Oct 17, 2005 5:41 am
- Location: Belgium
- Contact:
Re: Read directory on a FTP-connection
Hello,
It's working very nice.
The only problem is if no .LOG-file is available is still returning a len() of 1.
At the end I wanted to show how many files that are tranfered, but if no file is found, I still get 1.
For a workaround, I wanted to test for empty(aFiles[1,1]), but also this is returning NOT EMPTY.
If a do al len(aFiles[1,1])) or a len(alltrim(aFiles[1,1])), I allways get 260...
The workaround now is to test if len(alltrim(aFiles[1,1])) # 260
Regards,
Marc
It's working very nice.
The only problem is if no .LOG-file is available
Code: Select all
aFiles = oFTP:Directory('*.LOG')
At the end I wanted to show how many files that are tranfered, but if no file is found, I still get 1.
For a workaround, I wanted to test for empty(aFiles[1,1]), but also this is returning NOT EMPTY.
If a do al len(aFiles[1,1])) or a len(alltrim(aFiles[1,1])), I allways get 260...
The workaround now is to test if len(alltrim(aFiles[1,1])) # 260
Regards,
Marc
Regards,
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
- xProgrammer
- Posts: 464
- Joined: Tue May 16, 2006 7:47 am
- Location: Australia
Re: Read directory on a FTP-connection
Hi Marc and others
I have found a few issues with the FTP class.
The FTP server always gives a numeric response code which is not always handled appropriately - when you get a remote directory list the response code is added to the end of the list.
There is a problem with the transfer of 0 byte length files (easy enough to program around)
After downloading files remote directory listing stops working. Not sure why. So I build a complete listing of what I need to download before doing any downloading.
Hangs if remote file is unreadable - 500 series response code - comment in source says if 400 or 500 series response code but then only tests for a 400 series response code.
My experiences above just might help someone.
It would be nice if someone could resolve these issues with the current code.
Regards
xProgrammer
I have found a few issues with the FTP class.
The FTP server always gives a numeric response code which is not always handled appropriately - when you get a remote directory list the response code is added to the end of the list.
There is a problem with the transfer of 0 byte length files (easy enough to program around)
After downloading files remote directory listing stops working. Not sure why. So I build a complete listing of what I need to download before doing any downloading.
Hangs if remote file is unreadable - 500 series response code - comment in source says if 400 or 500 series response code but then only tests for a 400 series response code.
My experiences above just might help someone.
It would be nice if someone could resolve these issues with the current code.
Regards
xProgrammer
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: Read directory on a FTP-connection
I'm also experiencing problems with the directory function returning nothing under certain versions of windows (i think may be other configuration on the pc) the same app works fine on most installations, but returns nothing on others - as soon as i can see what the differences are i will let this forum know.
Regards,
Pete
Regards,
Pete