fyi: Directory.GetDirectories supports searching with a pattern argument of Type string that allows you to use certain wild-card characters ... asterisk and question-mark ... (but does not accept a RegEx expresion): [
^]
string searchPat = @"D:/Folder?/Folder*/Folder*";
DirectoryInfo di = new DirectoryInfo(@"D:\);
DirectoryInfo[] directories = di.GetDirectories(searchPattern, SearchOption.AllDirectories);
Once you have a list of all matching Directories, you can then copy the directories:
1. iterate over the array of DirectoryInfo in 'directories the wild-card search produced
2. get the 'FullName Property (the full file-path) of the DirectoryInfo: create a matching Directory on the target drive
Then you can recursively copy the contents of each Directory to the newly created target directory with the same name on the target drive.
There are lots of examples on the net with code for recursive folder copying; several are shown and discussed here: [
^]. There's a full example on this MDSN page: [
^] (the second code example).
Issues you might think about:
1. hidden files or folders ?
2. issues of access/role/permission when copying ?