WebClient Download Directory of Files

I can Download file by file some of the files I need to be able to download from my application.  Now I am finding that I need to download an entire directory of files.  The problem is, I will not know what files are in this directory.

How can I do this?

I imagine I need to somehow read the contents of the directory, and loop through all the files, and download each one individually?

p.s.  Cannot use FTP
p.s.s.  VB.Net (2008)
LVL 25
kevp75Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kevp75Author Commented:
p.s.s.s.  These files are remote files.

I am building a desktop application to manage my CMS.  I am trying to make it so the user can edit the content of the XML files locally, however, I need to download these content XML files in order to do this.   They are accessibly via a URI
0
kevp75Author Commented:
it would be great to be able to pass the good 'ol *.* wildcard to do this....
0
CodeCruiserCommented:
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

kevp75Author Commented:
Not VB.NET, but I can try my hand at converting it.

anything else?
0
kevp75Author Commented:
also...  this isn't a web applicaiton, it's a desktop app
0
CodeCruiserCommented:
Code behind is same.
0
kevp75Author Commented:
roughly.  just the structure looks different

(ps, I'm new at VB.NET)
0
selvolCommented:
Mabey I am missing something. Apologies if I am off .


I take it you cant or just enable Dir browsing? Correct
If you can read the contents of a web page in you app.  Then


simply adding the code below in a FIle what has a obfuscated name will allow you to view the content of the DIR.
If you don't use php.  There is a js equal......


Selvol 

<?php
$myDirectory = opendir(".");
while($entryName = readdir($myDirectory)) {
 $dirArray[] = $entryName;
}
closedir($myDirectory);
$indexCount = count($dirArray);
sort($dirArray);
print("<TABLE border=0 cellpadding=5 cellspacing=0 class=whitelinks>");
print("<TR><TH></TH></TR>");
for($index=1; $index < $indexCount; $index++) {
 if (substr("$dirArray[$index]",0,0) != "rar"){ // don't list hidden files
 print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");

 print("</TR>\n");
 }
}
print("</TABLE>\n");
?>

Open in new window

0
kevp75Author Commented:
sort of missing it, but I may end up having to go a route like that.  It looks like I can't simply browse a remote server folder structure.
0
CodeCruiserCommented:
If using the FTP would not warrant a jail for you, here is a useful FTP library

http://www.codeproject.com/KB/IP/FtpClient.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kevp75Author Commented:
what I think I am going to have to do is build a web service on the server to browse a directory and list out the files it contains
0
CodeCruiserCommented:
If its your own server and you want to go the webservice route, check this

http://www.codeproject.com/KB/webservices/wsfileserver.aspx
0
kevp75Author Commented:
I may be able to go that route as well.  Problem is I am unsure I want to open up an FTP account just for this...    though I may.

I will look through that tho
0
kevp75Author Commented:
thank you.  I ended up going the FTP route
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.