Surya Gupta
Surya Gupta

Reputation: 165

Traverse a directory over http

Suppose I have a url http://example.com/result, which will open a page,has some(number of directory could be one,two,three... any number of directories) directories. I want to traverse each directory and find out the new.txt file,which can be any where inside a dir or sub dir....

http://example.com/result has following dir:

security
major
minor
fails
logs
..

I need to find the new.txt inside every dir and want to read the content. All the directories (security/major/...etc) might have sub dir also. I need to find the new.txt inside a dir or sub directory.

Upvotes: 2

Views: 1746

Answers (1)

Neel
Neel

Reputation: 21297

If you want to do with python then you have to use urllib.

Check for the headers of each page. For directory and file there will be link tag. Go to that link tag and check for the headers. It might be possible that headers for file and directory will be different.

If its directory then recursive call the same function and check for each file in that directory.

Upvotes: 1

Related Questions