Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Enterprise Tools / September 2004

Tip: Looking for answers? Try searching our database.

Copy file from system to system -c#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
senthil Kumar - 17 Sep 2004 19:11 GMT
Hello
     Im using C# i tried to Copy a file from my system to another ,here the file what im trying to copy rest in a folder/directory which is a shared one.but im unable to copy the file .for copy it in local it works fine.I heard from the other side that network driver is to be mapped .what should i do to map the network driver.im using 1.0.3705 version of .net
the code whwt i tried is as follows.
private void b1_Click(object sender, System.EventArgs e)
        {  
sour=@"\\\\srini\\c:\\hello9.txt";
dest=@"\\\\pushpa\\d:\\hello.txt";
File.Copy(sour,dest,true);
        }
can any one help with code sample thanz in advance.

-----------------------

<Id>C67OG8gcQEybGgSemkZLdA==</Id
Mike Hayton [MS] - 20 Sep 2004 16:47 GMT
HI there

One problem I see below is that you're using the '@' with the string - this
means that the string will be taken literally and \'s are not treated as
escapes.

So either you'd probably want:
    sour="\\\\srini\\c:\\hello9.txt";
    dest="\\\\pushpa\\d:\\hello.txt";
    File.Copy(sour,dest,true);
or
    sour=@"\\srini\c:\hello9.txt";
    dest=@"\\pushpa\d:\hello.txt";
    File.Copy(sour,dest,true);

I also you have thought that the command would have been using the default
drive shares (i.e. c$ & d$ - you'll need to be an admin on the machines)
    sour=@"\\srini\c$\hello9.txt";
    dest=@"\\pushpa\d$\hello.txt";
    File.Copy(sour,dest,true);

What OS is on these two machines?
Id get it working from a command prompt using a copy command - once that's
working, it should give you the parameters into the File.Copy() method.

Mike

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------

| From: senthil Kumar
| Hello
|       Im using C# i tried to Copy a file from my system to another ,here the file what im trying to copy rest in a folder/directory which is a
shared one.but im unable to copy the file .for copy it in local it works
fine.I heard from the other side that network driver is to be mapped .what
should i do to map the network driver.im using 1.0.3705 version of .net
| the code whwt i tried is as follows.
| private void b1_Click(object sender, System.EventArgs e)
[quoted text clipped - 7 lines]
|
| <Id>C67OG8gcQEybGgSemkZLdA==</Id>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.