List files from web directory

Hi to all,

I will appreciate if anyone can guide me how can I list all names of files from a web directory …?

My desktop application must have this data from a webserver …

I’m not sure if can do that with httpsocket or with other control. If yes, how can I obtain the name of each file ?

`

dim http as new HTTPSocket
http.Get(“http://webserver/directory/”)

`

Thanks,

What you want to do looks very much like Scrapbook or other programs that save entire web sites to disk.

Unfortunately, for security reasons, as soon as there is an index page in a directory, you no longer can list it.

The way site savers work is :

  • Download the index page
  • inside that page, look for the content of the a tags and download each
<a href="anotherpage.htm">
  • In each of these pages, keep looking for linked pages on the same site. They usually are like the link above, without http://.
  • Go on until you find no more link.

Hi,

Michael thanks for your reply. The true is the app must access to a specif web directory where several images are stored. I need to list all available images in order to show it in the app for final user.

I understand your point of view regarding to security reasons. Just to say that that images are on my webserver. If I have the control of that web directory,really is not possible to do that task from a desktop app?

Regards,

It is not my point of view, it is the way the web works : if an index file is present, one cannot list a directory content.

If it is your web space, why not maintain a list of files that you download with httpsocket when needed ?

Michel,

You are right, it’s the web works. The only option is create a flatfile with all data and obtain that information with httpsocket to create a list for desktop app.

Again thanks.

When you navigate to that directly in a web browser do you get a list of files ?
If not then its unlikely you’re going to be able to get the desktop app to retrieve the list

Hi Norman,

All images are stored in a protected web directory on my server. I thought it was possible obtain the list of the files directly without use some flatfile or access a sqlite database for example.

he goal is create a list to download all files to hard drive and show this to final user. The detail is that images are being changed from time to time on the server. Is necessary download the files because the user does not haveinternet conection all times.

A desktop app has no special access to be able to do this
If you cant make a browser do it then the desktop app wont be able to either

That is UNLESS you write some kind of application that is running on your web server and then your desktop app COULD talk to that and have that application on the web server return a list of files

If it’s your webserver you just need FTP to access them.

There are others here who have more experience with FTP in Xojo than I though, so I will let them chime in. All I know is there is no built in method for FTP.

Thanks to all for ideas. I will analyze the different options.

-Read a flatfile
-Access database (sqlite could be more simpler)
-FTP method (I don’t have experience FTP+Xojo)
-Create a php routine and get data from this

Honestly, I don’t thought that the process to read a web folder from my desktop app was so complicated.

Every day I learn from all.

Regards.

There is yet another possibility, if your host supports it : create a Xojo web app that automatically maintains a list of links to all the pictures, so all your desktop app has to do is to load the list, and get all the pictures.

As you mention irregular Internet access, you can very well download the list, compare with the pictures you already downloaded, and get only the pictures you don’t have.