views:

27

answers:

3

If we know the URL, can we access the names of the files inside the parent directory. Like we do in dos, when we enter a folder we can view the list of files inside that directory by giving command

DIR

For Eg., If we have URL like http://www.ahilam.com . I want to know what are the files and folders inside the ahilam.com such as http://www.ahilam.com/courses, http://www.ahilam.com/login.php and so on....

This looks silly question. But eager to know whether it is possible

+1  A: 

This is usually not possible: HTTP has no directory listing function built in.

There is Apache's DirectoryListing directive that outputs a formatted HTML list of all files in a directory, but it is usually turned off.

The best you can do is crawl the URL's main page for any links. It is not guaranteed, though, that you will catch all existing files that way.

Pekka
A: 

Different web servers will provide different browse functions when you access a directory directly, and many will allow (indeed encourage) this to be disabled altogether. So the quick answer is: no, it's not possible.

David M
A: 

Take a look at the Directory Class.

tylermac
This is for processing directories in the local file system, not http.
Pekka
I had figured he was asking about a domain under his control.
tylermac