Listing Contents of Web Directory 
Author Message
 Listing Contents of Web Directory

On a daily basis, I need to download a series of log files from a web
server.  These files aren't on an FTP server; they are just stored in a
directory of the web server that I have access to.  I've been able to use
the System.Net namespace and the associated WebClient.DownloadFile method
rather successfully.  I have no problems downloading a file when I know it's
name beforehand.

My problem is that there are not always the same number of log files
produced every day, and thus I don't always know which files are available
for downloading.  I need to find a way of either: (1) obtaining a list of
directory's contents, so that I know the names of all the files it holds, or
(2) testing to see whether a particular file exists before attempting to
download it.

Strangely enough, the DownloadFile will not throw an execption when you ask
it to download a file that doesn't exist.  Instead, it downloads the raw
HTML of the server's "File Not Found" message.  If I can't get any ideas
here, I suppose that I can just download each file that might be there, test
its contents to see if it contains this error message, and delete it if it
does.  But that is such a waste of bandwidth!  Any ideas?

Thanks in advance.


Sat, 06 Aug 2005 04:02:13 GMT  
 [ 1 post ] 

 Relevant Pages 

1. List Directory Contents in Menu

2. Getting directory list of a folder's contents

3. how to list directory contents

4. Listing the contents of a directory through script?

5. List contents of a directory

6. Showing contents of a directory in a list box

7. Listing contents of a directory programmatically

8. list contents of remote directory (http)

9. Web directory file list

10. Listing Web Directory

11. Listing of files in a directory on the Web Server

12. Using AppGetStatus on IIS web directory or virtual directory object


Powered by phpBB® Forum Software