Geeks With Blogs
Wil Peck Experience is something you get right after you need it. September 2009 Entries
DirectoryInfo.CopyContentsTo(destinationDirectory)
Really no magic here and just a simple add on to my previous post just in case you need something that can easily copy the contents of a given directory to another location. public static void CopyContentsTo(this DirectoryInfo source, string desinationDirectory) { if (string.IsNullOrEmpty(desin... { throw new ArgumentNullException("root... } if (!Directory.Exists(desinati... { Directory.CreateDirectory(d... } foreach (string file in Directory.GetFiles(source.F... ......

Posted On Monday, September 14, 2009 8:40 PM

DirectoryInfo.CopyTo
The .NET Framework does not offer support for a directory copy method OOB. Fortunately in .NET 3.5 we can decorate the DirectoryInfo method with our own CopyTo method using an extension method. See the below example… public static class DirectoryInfoExtensions { public static void CopyTo(this DirectoryInfo source, string rootDestinationDirectory, bool recursive) { if (string.IsNullOrEmpty(rootD... { throw new ArgumentNullException("dest... } if (!Directory.Exists(rootDest... ......

Posted On Friday, September 11, 2009 9:46 AM

Copyright © Wil Peck | Powered by: GeeksWithBlogs.net