예제 #1
0
        public static void CopyDirectory(string src, string dst)
        {
            String[] files;

            if (dst[dst.Length - 1] != Path.DirectorySeparatorChar)
            {
                dst += Path.DirectorySeparatorChar;
            }
            if (!SafeDirectory.Exists(dst))
            {
                SafeDirectory.CreateDirectory(dst);
            }
            files = SafeDirectory.GetFileSystemEntries(src);
            foreach (string element in files)
            {
                // Sub directories

                if (SafeDirectory.Exists(element))
                {
                    CopyDirectory(element, dst + Path.GetFileName(element));
                }
                // Files in directory

                else
                {
                    SafeFile.Copy(element, dst + Path.GetFileName(element), true);
                }
            }
        }
예제 #2
0
        public static void CopyDirectory(string Src, string Dst)
        {
            String[] Files;

            if (Dst[Dst.Length - 1] != Path.DirectorySeparatorChar)
            {
                Dst += Path.DirectorySeparatorChar;
            }
            if (!SafeDirectory.Exists(Dst))
            {
                SafeDirectory.CreateDirectory(Dst);
            }
            Files = SafeDirectory.GetFileSystemEntries(Src);
            foreach (string Element in Files)
            {
                // Sub directories

                if (SafeDirectory.Exists(Element))
                {
                    CopyDirectory(Element, Dst + Path.GetFileName(Element));
                }
                // Files in directory

                else
                {
                    SafeFile.Copy(Element, Dst + Path.GetFileName(Element), true);
                }
            }
        }