/// <summary> /// Deletes the specified directory and, if indicated, any subdirectories and files in the directory. /// </summary> /// <param name="info">The name of the directory to remove. </param> /// <param name="recursive">true to remove directories, subdirectories, and files in path; otherwise, false. </param> /// <remarks>http://msdn.microsoft.com/en-us/library/fxeahc5f(v=vs.110).aspx</remarks> /// <exception cref="PathNotFoundException">One or more intermediate directories do not exist; this function will only create the final directory in the path.</exception> /// <exception cref="DirectoryNotEmptyException">The directory is not empty.</exception> /// <example> /// Creates directory structure /// <code> /// public static void Create_With_StringPath_Example() /// { /// QuickIOPathInfo pathInfo = new QuickIOPathInfo( @"C:\temp\QuickIOTest\sub\folder\tree" ); /// /// // Deletes directory C:\temp\QuickIOTest\sub\folder\tree and subfolders and files /// QuickIODirectory.Delete( pathInfo, recursive: true ); /// } /// </code> /// </example> /// <example> /// Shows how to handle sample exception if directory is not empty /// <code> /// public static void Create_With_StringPath_Example() /// { /// QuickIOPathInfo pathInfo = new QuickIOPathInfo( @"C:\temp\QuickIOTest\sub\folder\tree" ); /// /// try /// { /// QuickIODirectory.Delete( pathInfo, recursive: false ); /// } /// catch ( DirectoryNotEmptyException directoryNotEmptyException ) /// { /// // Directoy is not empty /// } /// } /// </code> /// </example> public static void Delete(QuickIOPathInfo info, bool recursive = false) { InternalQuickIO.DeleteDirectory(info.FullNameUnc, recursive); }