Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 9 SP2 and FTP Question

Status
Not open for further replies.

foxlover2012

Programmer
Sep 2, 2012
29
US
Hello all,
I have all the functions to transfer a file, delete file and get a file from a web folder. However, I need to read all the filenames on a web directory into an array in VFP. Does anyone have code for this? Thanks so much! John
 
How about FTP? sending an NLST command?
VFPConnection from Craig Boyd can do that.

Bye, Olaf.

 
What tool are you using for retrieving, deleting, etc? Whatever you are using, the chances are that it has a function to read the directory, but we would need to know which tool it is.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
What Mike said.

I usually use West-Wind's tools for doing anything with FTP and I know it includes a function very similar to VFP's ADIR() to get lists of files on the remote server.

What does your tool offer?
 
Thanks, I modified a program I found by Dave Summers to suit my needs. It is totally embedded in my programs and works great for transferring and receiving.
The problem I now have is that I'm not always sure what the filename will be on the web server and I need to get a list of available files.
It only contains, PUT, GET and DELETE.
Thanks John
 
Well, the ftpclient form has a listing of files remote andd local, doesn't it?
What's the problem with it?

Bye, Olaf.
 
I'm not familiar with Dave's program, but at first glance it looks like an interactive tool, rather than a set of functions that you call from your own application. If that's the case, you will need to amend the source code, which should be straightforward.

You'll see that somewhere it is sending FTP commands to the server, such as GET, PUT, RENAME and DELETE. What you need to do is to add a DIR command. The command can optionally be followed by a filespec (such as *.HTML).

Dave is a frequent visitor to this forum, so with luck he'll see this and step in with more information. Alternatively, you could contact him directly; there's a link to his email address on his home page.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Dave comes into this forum area from time to time (last here: 19 Aug 13), so perhaps he will see your question and give you the tool-specific answers you need.

Good Luck
JRB-Bldr
 
Here I am! I do try to get here every day, but don't always make it.

Anyway,
It only contains, PUT, GET and DELETE.
Actually, if you look at the 'Click' event on the 'Refresh' button under the remote file list, there is a call to "THISFORM.remoteDir2array" which uses the following API calls to get the remote directory listing, which in turn populates an array that the 'Remote' ListBox uses:
FtpFindFirstFile
InternetFindNextFile

It would probably be best for you to step through the code and see all what it does rather than me write a novel here. I think it's fairly easy to follow.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Dave and all,
I'm not using the interactive version. Somewhere I download a .PRG file that contains some functions (PUT, GET, and DELETE) that you had written. Your credit is still at the last line of the file with your web address.
Bet you didn't know anyone was using that code, but it has been very helpful! Thank you!
I want my user shielded from an interface and those functions work great as I have now expanded upon them over the years.
Would you mind if I used code from your interactive version and put in my project?
I will still give you credit at the end of my file!

I think I found this file before the interactive version was published!
Thanks, John
 
Ah, I'm guessing you got the code from the F.A.Q. then.
How do I transfer files using FTP?
faq184-3234

If that's the case, you are correct. There is no code there to do a directory listing.
But feel free to use the code in the interactive version, as the code in that form is derived from the F.A.Q., or vice-versa.
I used code in both 'projects' that I had adapted from various sources, put the ideas together and bundled them. So really, I don't claim the code as my own, just the effort. I'm glad to be of service!


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top