In my application I\'m trying to rename the folder, but if the folder is opened in Windows Explorer I get an IOException. How can I identify whether folder is
It is not reasonable to determine if a program has a folder open in such a way that prevents you from renaming it. Because immediately after you make the determination, another process could start or stop using the folder. Instead just do the operation and catch the resulting exception.
try {
Directory.Move("old","new");
return true;
} catch ( IOException ) {
return false;
}