io.file.copy with username/password?

sdlangers

Well-known member
Joined
Dec 3, 2002
Messages
118
I have a program that basically copies files from a unc path (//myotherserver/path/file.txt) to the local machine (d:\destpath\file.txt)

it uses system.io.file.copy

however, it says the remote path does not exist - this is because you need a username and password to connect to it

is there any way i can specify this username/password within my program code?

thanks
 
sdlangers said:
I have a program that basically copies files from a unc path (//myotherserver/path/file.txt) to the local machine (d:\destpath\file.txt)

it uses system.io.file.copy

however, it says the remote path does not exist - this is because you need a username and password to connect to it

is there any way i can specify this username/password within my program code?

thanks

Are you sure the DestPath exist? if not you need to create it first ... to do this:
C#:
if(!Directory.Exist("D:\\destpath"))
{
    Directory.Create("D:\\destpath"));
}
File.Copy(strPath,strdest);
 
Shurikn said:
Are you sure the DestPath exist? if not you need to create it first ... to do this:
C#:
if(!Directory.Exist("D:\\destpath"))
{
    Directory.Create("D:\\destpath"));
}
File.Copy(strPath,strdest);

yes - it definitely exists - it just needs the username/password - thats what i need to know - how can you code it to specify the username/password?
 
Back
Top