I am using PowerShell to delete all files from a folder.
Remove-Item C:\ProgramData\Microsoft\SF\Log\Traces\* -Force
Problem is it throws Access is denied
error because there is one file (the latest one generated by the process) being used by some process.
If I try to delete that particular file using Delete
button on keyword then I get same error. But if I use Shift + Delete
then I am able to delete file successfully.
Even if I run PowerShell as Administrator, I get same error.
How do I tell PowerShell to Shift + Delete
file?