I have quite a simple app, which modify the CreationTime property of all the subfiles and subfolders in a folder, the code is like:
void Mod(DirectoryInfo dir, DateTime time)
foreach (DirectoryInfo subDir in dir.GetDirectories())
foreach (FileInfo fi in dir.GetFiles())
fi.CreationTime = time;
dir.CreationTime = time;
I call this method with a folder like: C:\a\b, then all the subfiles and subfolders are correctly modified, but WHY I received an Exception: The process cannot access the file 'C:\a\b' because it is being used by another process.
I changed the folder to: C:\a, then C:\a\b was modified successfully, then I got an Exception:The process cannot access the file 'C:\a' because it is being used by another process.
thanks in advance.
View Complete Post