I assume that the .NET DirectoryInfo and FileInfo objects are similar to Java java.io.File, i.e. represent abstract paths and are not necessarily related to existing physical paths.
I can do what I am trying to do (free the folder and create it if it does not exist) in a different way, but I would like to understand why it is not:
using System.IO; namespace TestWipeFolder { internal class Program { private static void Main(string[] args) { var di = new DirectoryInfo(@"C:\foo\bar\baz"); if (di.Exists) { di.Delete(true); }
UPDATE . I tried the same code after reboot and it worked fine. I still want to know what the similarity with Java File objects is and whether the directory removes links to DirectoryInfo objects, but this is already in the background.
source share