DirectoryInfo dir = new DirectoryInfo(Directory.GetCurrentDirectory()); string s = @"C:\"; dir.MoveTo(s);
Text in s for example. Whichever path is inserted, the exception still flies.
An exception:
"The process cannot access the file because the file is being used by another process."
What's wrong? Like the simplest code.
UPD 03/24/16. 17.45.
If someone needs, I can put the search algorithm up in folders.
Searches the current folder for the desired folder / file / files with the specified extension. If not found, it rises to a higher level and searches there, even higher, and so on. Optionally - search in subfolders, maximum number of levels of "lifting" up, the name of the desired directory, file search mask (one file or files with a specified extension), folder start searching.
At the exit - the path to the found folder. Search lazy - to the first found folder in which there are the required files.