sdlangers Posted July 21, 2005 Posted July 21, 2005 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 Quote
Shurikn Posted July 25, 2005 Posted July 25, 2005 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: if(!Directory.Exist("D:\\destpath")) { Directory.Create("D:\\destpath")); } File.Copy(strPath,strdest); Quote
sdlangers Posted July 25, 2005 Author Posted July 25, 2005 Are you sure the DestPath exist? if not you need to create it first ... to do this: 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? Quote
SonicBoomAu Posted July 25, 2005 Posted July 25, 2005 Have a look at this website http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_peht.mspx Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
sdlangers Posted July 25, 2005 Author Posted July 25, 2005 Have a look at this website http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_peht.mspx thats what i needed - perfect.. thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.