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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Listing

Status
Not open for further replies.

jem122974

Programmer
Nov 1, 2001
114
US
I have a URL that I would like to get a directory listing of the files and directories it contains. It really points to the UNC path \\drawings.ejiw.com\vol1\drawings\pdfs.

I have a program that takes the UNC path and instatiates a new File object. From this I can call listFiles() and get my list.

And if I enter the URL in IE it gives me a directory listing. I guess this is some option on the web server.

The web server listing is fine for now, but I'd really like to have it match the rest of our site and have some email links. Also the users are not going to have access to the UNC path, only the URL. So, is there a way to get a directory listing from a URL in Java?

Thanks,
Jon Mitchell
 
Have you tried instantiating the File object with a URI object instead of a String? Or or you already doing this?
 
I tried that but got an error that it wasn't a valid file.

What I ended up doing was taking the HTML that the web server return for the URL and parsed out the file names. Then I displayed these as links on my JSP.

The catch here is if I change my web server the format of the HTML that it returns for a directory listing may change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top