https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2f9b4a2e9f09e1de31ca3…
commit 2f9b4a2e9f09e1de31ca39f1fb734fee859bcb17
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Jul 11 20:34:18 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Aug 19 20:36:06 2020 +0200
[CMD] RMDIR: Force directory deletion even if it's read-only, only when recursing
over subdirectories (via the /S option).
---
base/shell/cmd/internal.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/base/shell/cmd/internal.c b/base/shell/cmd/internal.c
index 95416b4278b..3de6368583f 100644
--- a/base/shell/cmd/internal.c
+++ b/base/shell/cmd/internal.c
@@ -408,6 +408,7 @@ BOOL DeleteFolder(LPTSTR FileName)
}
else
{
+ /* Force file deletion */
SetFileAttributes(TempFileName, FILE_ATTRIBUTE_NORMAL);
if (!DeleteFile(TempFileName))
{
@@ -420,6 +421,8 @@ BOOL DeleteFolder(LPTSTR FileName)
FindClose(hFile);
}
+ /* Force directory deletion even if it's read-only */
+ SetFileAttributes(FileName, FILE_ATTRIBUTE_NORMAL);
return RemoveDirectory(FileName);
}
@@ -506,6 +509,7 @@ INT cmd_rmdir(LPTSTR param)
}
else
{
+ /* Without /S, do not force directory deletion even if it's read-only */
res = RemoveDirectory(arg[i]);
}