How can I get a list of all files in a directory on a webserver?
-
I think the title explains it all:I'm looking to get a list of all files in a specific directory from a web server- www.site.com/docs/. The thing is, there's an index.htm file in that directory so if I browse to it, I just get the index file. Is there any way to find out the names of all files in that directory, scripting or otherwise? I don't have access to the system other than through the standard web interface(ie: no shell, etc.) Any ideas?
-
Answer:
Directory browsing is a server level thing. If they've put up an index.html file for that directory, there's not a lot you can do. The only thing that might help you is a google search (or the yahoo/msn equivalent) that looks something like one of these site:site.com inurl:docs site:www.site.com inurl:docs What that's saying is only search the site.com domain, and the word "docs" must be in the URL. This will only work, however, if the files in that directory were linked to at one point, and the search engine spider grabbed that page.
newatom at Ask.Metafilter.Com Visit the source
Other answers
If they're not linked from either the index.htm file (or elsewhere on the site or web), then no, not really. However, if you know that they have a guessable naming scheme: doc01.txt doc02.txt doc03.txt ...then it would be trivial to write a shell script that would attempt to grab all these files. It would be blatantly obvious in the web logs too - if anyone was checking.
unixrat
The only way to do it is to find all references elsewhere to that path, possibly by searching for it at google or somewhere else that has a big crawler. Or you could mail the owner and ask them. The feature you're running into is specifically and deliberately intended to prevent outsiders like you from getting a listing of the directory contents, so that files can be put in there without being seen by you or anyone else. And there's no way I've ever heard of to bypass it. (Speaking as a web site owner who uses this feature for precisely the purpose of hiding the directory listing of some of my directories from outsiders I don't want poking around in them.)
Steven C. Den Beste
You could use http://www.httrack.com/ and grab a local copy, assuming you've got the disk space.
JaredSeth
Solutions involving HTTrack and similar programs, or Google and similar crawlers, rely on a page somewhere linking to the files in the directory. If the file isn't linked anywhere, i.e. you can't work out the filename, you're out of luck.
Aloysius Bear
This would be a pretty serious security flaw if it were possible.
rhizome
Good point about the limitations of HTTrack, Aloysius. I guess I just naturally assumed he was looking for the stuff referenced from other pages on the site.
JaredSeth
The impossibility of this is one of the main reasons I put an empty index.html in most directories full of "shared stuff" on my web server.
jozxyqk
The PHP function http://us2.php.net/function.opendir can do it.
tremolo1970
Oops...actually, I guess you would use opendir() and http://us2.php.net/manual/en/function.readdir.php.
tremolo1970
Related Q & A:
- How can I find a list of births in Wiesbaden, Germany?Best solution by Yahoo! Answers
- How do I get a list of yahoo groups?Best solution by Yahoo! Answers
- How can I get an audio alert when I get a new e-mail?Best solution by Yahoo! Answers
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
- How can I get a job at a resort for a Summer?Best solution by eHow old
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.