its very important to have this programatic service which will do this for us instead of doing it manually....
this one function and a class will do this all...you just need to send your source and destination path in this function it will do all for you....
public void CopyFiles(string source, string destination)
{
Stack<LocRecords> direcotiresLoc = new Stack<LocRecords>();
direcotiresLoc.Push(new LocRecords(source,destination));
while(direcotiresLoc.Count>0)
{
LocRecords location = direcotiresLoc.Pop();
string destPath=Path.Combine(location.Destiantion, Path.GetFileName(location.Source));
foreach (string dir in System.IO.Directory.GetDirectories(location.Source))
{
if (!System.IO.Directory.Exists(dir))
{
System.IO.Directory.CreateDirectory(destPath);
}
direcotiresLoc.Push(new LocRecords(dir, destPath));
}
foreach (string files in Directory.GetFiles(location.Source))
{
File.Copy(files, destPath);
}
}
}
public class LocRecords
{
public string Source { get; set; }
public string Destiantion { get; set; }
public LocRecords(string source, string dest)
{
Source = source;
Destiantion = dest;
}
}
I used this stack approach because it is more faster then recursive methods. It moves files on LAN with much faster speed as compare to recursive methods.
I hope this going to help you.... Please let me know if you need my help....