boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

How to copy a directory in C# .NET

Updated on     Kisan Patel

This tutorial will show you how to copy a directory in C# .NET.

Here is the method to copy a directory using C#.

static void CopyDir(DirectoryInfo src, DirectoryInfo target)
{
    if (!target.Exists)
    {
        target.Create();
        FileInfo[] files = src.GetFiles();
        foreach (FileInfo file in files)
        {
            file.CopyTo(Path.Combine(target.FullName, file.Name));
        }
        DirectoryInfo[] dirs = src.GetDirectories();
        foreach (DirectoryInfo dir in dirs)
        {
            string destinationDir = Path.Combine(target.FullName, dir.Name);
            CopyDir(dir, new DirectoryInfo(destinationDir));
        }
    }
}

In this method, we have use GetDirectories method that returns the sub-directories of the current directory. GetFiles method retrieves a file list from the current directory. You could use above method as shown in below code:

DirectoryInfo source = new DirectoryInfo(src_path);
DirectoryInfo target = new DirectoryInfo(target_path);
CopyDir(source, target);

C#

Leave a Reply