473,385 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple file download from network drive via web

Hello all,

I have been trying to determine the best way to do this, but can't
seem to get any solution to work exactly the way I want. The scenario
is that I have some xml files being placed on a network drive of one
of our servers. I needed to copy this files to my web server to do
processing. Ideally I was going to write a server service that
monitor wold monitor that directory so that when a new file appeared
it was automatically copied and I may still look at doing that.

However right now I am just trying to perform a copy of the whole
directory contents via a link in my ASP.NET/C# web app. One thing I
did was to create a virtual directory on my iis box, set it up as an
application and point it to the UNC of the file. That seems to work.
Then Ifound some sample code:

string RemoteFolder = @"http://www.bogussite.com/123/";
string RemoteFile = "123.xml";
string url = RemoteFolder + RemoteFile;
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(url);
HttpWebResponse webResponse =
(HttpWebResponse)webRequest.GetResponse();
StreamReader sr = new
StreamReader(webResponse.GetResponseStream());
string filecontent = sr.ReadToEnd();
StreamWriter sw = new StreamWriter(@"C:\Inetpub\wwwroot
\putthemhere\123.xml");
sw.Write(filecontent);
sw.Flush();
sw.Close();
sr.Close();

This works great, but only copies one file and doesn't seem to like
wild cards, *.xml would be ideal. I also look at trying to use
WebClient.download file but that did not seem to work for multiple
files either.

Any thoughts would be appreciated.
Greg
Jan 16 '08 #1
2 2275
http unlike ftp does not support directory directives or multiple file
download.

you could add an aspx page or webservice that returned a directory listing.
you could also turn on directory browsing. with directory browsing, a get of
the site root returns a directory list. you woudl have to pase the list
becuase its not in a standard format.

-- bruce (sqlwork.com)
"gh***@medex.com" wrote:
Hello all,

I have been trying to determine the best way to do this, but can't
seem to get any solution to work exactly the way I want. The scenario
is that I have some xml files being placed on a network drive of one
of our servers. I needed to copy this files to my web server to do
processing. Ideally I was going to write a server service that
monitor wold monitor that directory so that when a new file appeared
it was automatically copied and I may still look at doing that.

However right now I am just trying to perform a copy of the whole
directory contents via a link in my ASP.NET/C# web app. One thing I
did was to create a virtual directory on my iis box, set it up as an
application and point it to the UNC of the file. That seems to work.
Then Ifound some sample code:

string RemoteFolder = @"http://www.bogussite.com/123/";
string RemoteFile = "123.xml";
string url = RemoteFolder + RemoteFile;
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(url);
HttpWebResponse webResponse =
(HttpWebResponse)webRequest.GetResponse();
StreamReader sr = new
StreamReader(webResponse.GetResponseStream());
string filecontent = sr.ReadToEnd();
StreamWriter sw = new StreamWriter(@"C:\Inetpub\wwwroot
\putthemhere\123.xml");
sw.Write(filecontent);
sw.Flush();
sw.Close();
sr.Close();

This works great, but only copies one file and doesn't seem to like
wild cards, *.xml would be ideal. I also look at trying to use
WebClient.download file but that did not seem to work for multiple
files either.

Any thoughts would be appreciated.
Greg
Jan 16 '08 #2
Welcome to the programming....
Sometimes you will have to write code yourself, the code you have is a good
start :)
George.

<gh***@medex.comwrote in message
news:86**********************************@c23g2000 hsa.googlegroups.com...
Hello all,

I have been trying to determine the best way to do this, but can't
seem to get any solution to work exactly the way I want. The scenario
is that I have some xml files being placed on a network drive of one
of our servers. I needed to copy this files to my web server to do
processing. Ideally I was going to write a server service that
monitor wold monitor that directory so that when a new file appeared
it was automatically copied and I may still look at doing that.

However right now I am just trying to perform a copy of the whole
directory contents via a link in my ASP.NET/C# web app. One thing I
did was to create a virtual directory on my iis box, set it up as an
application and point it to the UNC of the file. That seems to work.
Then Ifound some sample code:

string RemoteFolder = @"http://www.bogussite.com/123/";
string RemoteFile = "123.xml";
string url = RemoteFolder + RemoteFile;
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(url);
HttpWebResponse webResponse =
(HttpWebResponse)webRequest.GetResponse();
StreamReader sr = new
StreamReader(webResponse.GetResponseStream());
string filecontent = sr.ReadToEnd();
StreamWriter sw = new StreamWriter(@"C:\Inetpub\wwwroot
\putthemhere\123.xml");
sw.Write(filecontent);
sw.Flush();
sw.Close();
sr.Close();

This works great, but only copies one file and doesn't seem to like
wild cards, *.xml would be ideal. I also look at trying to use
WebClient.download file but that did not seem to work for multiple
files either.

Any thoughts would be appreciated.
Greg

Jan 17 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Radioactive Man | last post by:
I am fairly new to the latest verion of Python and using it on windows 95, 2000, and/or XP. What libraries, modules, functions, etc. would I need to set up a Python script to download a file, say...
4
by: Billy Jacobs | last post by:
Is there a way to download multiple files from a server? If not then: How do I zip up multiple files using the .net classes in vb? Thanks Billy Jacobs
1
by: intl04 | last post by:
Are there any problems with multiple user access to the same Access database on a shared network drive? I have 'shared' chosen for 'default open mode'. As for the record locking properties, I...
8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
11
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
4
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
3
by: Barry Flynn | last post by:
Hi I am working with a VB 2005 program which has been converted from VB6. It writes data out to a flat file, with code like the following line WriteLine(riFileNo, "Hist", lsAssetID,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.