mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 10:52:20 +00:00
[CMD] RMDIR: Force directory deletion even if it's read-only, only when recursing over subdirectories (via the /S option).
This commit is contained in:
parent
7c175d4999
commit
2f9b4a2e9f
1 changed files with 4 additions and 0 deletions
|
@ -408,6 +408,7 @@ BOOL DeleteFolder(LPTSTR FileName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Force file deletion */
|
||||||
SetFileAttributes(TempFileName, FILE_ATTRIBUTE_NORMAL);
|
SetFileAttributes(TempFileName, FILE_ATTRIBUTE_NORMAL);
|
||||||
if (!DeleteFile(TempFileName))
|
if (!DeleteFile(TempFileName))
|
||||||
{
|
{
|
||||||
|
@ -420,6 +421,8 @@ BOOL DeleteFolder(LPTSTR FileName)
|
||||||
FindClose(hFile);
|
FindClose(hFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Force directory deletion even if it's read-only */
|
||||||
|
SetFileAttributes(FileName, FILE_ATTRIBUTE_NORMAL);
|
||||||
return RemoveDirectory(FileName);
|
return RemoveDirectory(FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,6 +509,7 @@ INT cmd_rmdir(LPTSTR param)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Without /S, do not force directory deletion even if it's read-only */
|
||||||
res = RemoveDirectory(arg[i]);
|
res = RemoveDirectory(arg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue