I want to search a file from server and want to copy it to the local disk.
how it is done? This is working if the file is in my hard disk itself.But not when it comes to server. If i map the server i can search.like y:\\serverfolde \\folder am tring to make an exe. different people will map to different drive. so i cant give like that.should give like @\\server\\serv erfolde\\folder \\ but it is not working.
My code is<code>
searchfolder="y :\\Template\\el se";
destination ="D:\\Princy\\M y Documents\\proj ect\\";
string source=searchfo lder+"\\"+"mod5 01_"+filetosear ch+".3d";
string target=destinat ion+"mod501-"+filetosearch+ ".3d";
string[] files = Directory.GetFi les(searchfolde r, "mod501_"+filet osearch+".3d");
//string[] files = Directory.GetFi les(searchfolde r, filetosearch+"* ");
if(files.Length ==1)
{
foreach (string dir in files)
{
lblcnt.Text="Se lected File: "+ dir;
string[] search = Directory.GetFi les(destination ,"mod501-"+filetosearch+ ".3d");
if(search.Lengt h>0)
{
lblcnt.Visible= true;
lblcnt.Text="Fi le already exist";
}
else
{
File.Copy(sourc e,target);
lblcnt.Visible= true;
lblcnt.Text="Fi le copied";
}
}
</code>
what to give insted of
searchfolder="y :\\Template\\el se";
If am using
searchfolder="@ books\\template \\Template\\els e";
am geting error:
System.IO.Direc toryNotFoundExc eption:Could not find a part of the "@books\templat e\Template\els" .
Otherwise its working perfectly.
how it is done? This is working if the file is in my hard disk itself.But not when it comes to server. If i map the server i can search.like y:\\serverfolde \\folder am tring to make an exe. different people will map to different drive. so i cant give like that.should give like @\\server\\serv erfolde\\folder \\ but it is not working.
My code is<code>
searchfolder="y :\\Template\\el se";
destination ="D:\\Princy\\M y Documents\\proj ect\\";
string source=searchfo lder+"\\"+"mod5 01_"+filetosear ch+".3d";
string target=destinat ion+"mod501-"+filetosearch+ ".3d";
string[] files = Directory.GetFi les(searchfolde r, "mod501_"+filet osearch+".3d");
//string[] files = Directory.GetFi les(searchfolde r, filetosearch+"* ");
if(files.Length ==1)
{
foreach (string dir in files)
{
lblcnt.Text="Se lected File: "+ dir;
string[] search = Directory.GetFi les(destination ,"mod501-"+filetosearch+ ".3d");
if(search.Lengt h>0)
{
lblcnt.Visible= true;
lblcnt.Text="Fi le already exist";
}
else
{
File.Copy(sourc e,target);
lblcnt.Visible= true;
lblcnt.Text="Fi le copied";
}
}
</code>
what to give insted of
searchfolder="y :\\Template\\el se";
If am using
searchfolder="@ books\\template \\Template\\els e";
am geting error:
System.IO.Direc toryNotFoundExc eption:Could not find a part of the "@books\templat e\Template\els" .
Otherwise its working perfectly.
Comment