source/R5T.NetStandard.Types/Code/Helpers/DirectoryHelper.cs
/// <summary>
/// Deletes a directory path.
/// The <see cref="System.IO.Directory.Delete(string)"/> method throws a <see cref="System.IO.DirectoryNotFoundException"/> if attempting to delete a non-existent directory. This is annoying.
/// All you really want is the directory to not exist, so this method simply takes care of checking if the directory exists.
/// Also annoying, you need to specify the recursive option to delete a directory with anything in it. This method also takes care of specifying true for the recursive option.
/// Even more annoying, even after specifying the recursive option, the system method will not delete read-only files. Thus this method disables read-only options on all files recursively.
/// </summary>
Deletes a directory path.
The  method throws a  if attempting to delete a non-existent directory. This is annoying.
All you really want is the directory to not exist, so this method simply takes care of checking if the directory exists.
Also annoying, you need to specify the recursive option to delete a directory with anything in it. This method also takes care of specifying true for the recursive option.
Even more annoying, even after specifying the recursive option, the system method will not delete read-only files. Thus this method disables read-only options on all files recursively.
Deletes a directory path . The method throws a if attempting to delete a non - existent directory . This is annoying . All you really want is the directory to not exist so this method simply takes care of checking if the directory exists . Also annoying you need to specify the recursive option to delete a directory with anything in it . This method also takes care of specifying true for the recursive option . Even more annoying even after specifying the recursive option the system method will not delete read - only files . Thus this method disables read - only options on all files recursively .
public static void Delete(string directoryPath)
        {
            if(Directory.Exists(directoryPath))
            {
                DirectoryHelper.DisableReadOnly(directoryPath);
                Directory.Delete(directoryPath, true);
            }
        }
public static void Delete ( string directoryPath ) { if ( Directory . Exists ( directoryPath ) ) { DirectoryHelper . DisableReadOnly ( directoryPath ) ; Directory . Delete ( directoryPath , true ) ; } }
Deletes a directory path.
Deletes a directory path .
directoryPath
string