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

How to recursively download files/folders from host machine to client

Status
Not open for further replies.

pujas

Programmer
Feb 2, 2005
22
0
0
US
Hi all,

I'am trying to download files using VB from a host http machine. Currently i'am using inet.openurl(" to get one file at a time.
I wanted to know a way of getting all the files in the dir and also getting all subdirectores.

I have a folder called xyz which is on a host machine.
xyz contains 1 or 2 files and 2 or 3 subdirectories. Nothing is static. It could contain as many files and folder in the dir. The subfolders also have files and other folder and so on.

what i need to do is get all the files and sub folders/subfolders/files in xyz into my local machine in a similar way as its stroed in the host machine.

the code right now i'am using for getting 1 file from host and copying on my machine c:\

Set Inet = CreateObject("InetCtls.Inet.1")
Inet.Protocol = icHTTP
Dim bytRet() As Byte
Dim strDate As String
Dim intCnt As Integer
bytRet = Inet.OpenUrl(" ' icByteArray)
Do While Inet.StillExecuting ' Waiting
DoEvents
Loop
Open "c:\xyz.txt" For Binary Access Write As #fn
Put #fn, , bytret()
DoEvents
Close the open file
Close #fn

I need a solution to recursively copy all the files and folders from the host to my client machine

Any pointers in the right direction would be really really helpful..

Thanks in advance
 
It will probably depend on the web server.

Many have directory browsing turned off, and others have default pages for a directory... so you're probably out of luck for most we servers.

If the server had directory browsing enabled and default pages disabled then it is a matter of parsing the "page" returned by that particular server.

If you are trying to do a site capture you may be better off just following all of the links.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top