src/SyncTool.Utilities/main/DirectoryHelper.cs
/// <summary>
/// Deletes the specified directory recursively if it exists. If files within the directory are write-protected
/// the protection will be removed and the will will be deleted anyways
/// </summary>
Deletes the specified directory recursively if it exists. If files within the directory are write-protected
the protection will be removed and the will will be deleted anyways
Deletes the specified directory recursively if it exists . If files within the directory are write - protected the protection will be removed and the will will be deleted anyways
public static void DeleteRecursively(string directoryPath)
        {
            if (!Directory.Exists(directoryPath))
            {
                return;
            }
            var directoryInfo = new DirectoryInfo(directoryPath);
            directoryInfo.Attributes = FileAttributes.Normal;
            foreach (var info in directoryInfo.GetFileSystemInfos("*", SearchOption.AllDirectories))
            {
                info.Attributes = FileAttributes.Normal;
            }
            directoryInfo.Delete(true);
        }
public static void DeleteRecursively ( string directoryPath ) { if ( ! Directory . Exists ( directoryPath ) ) { return ; } var directoryInfo = new DirectoryInfo ( directoryPath ) ; directoryInfo . Attributes = FileAttributes . Normal ; foreach ( var info in directoryInfo . GetFileSystemInfos ( " " , SearchOption . AllDirectories ) ) { info . Attributes = FileAttributes . Normal ; } directoryInfo . Delete ( true ) ; }
Deletes the specified directory recursively if it exists.
Deletes the specified directory recursively if it exists .
// if the directory dows not exist, we can return right away // remove read-only flag from all files before deleting    
directoryPath
string