Cannot remove item. The directory is not empty

You could try the following:

Remove-Item -Force -Recurse -Path "$directoryPath\*"

Note when using the -Recurse parameter with -Include in Remove-Item, it can be unreliable. So it’s best to recurse the files first with Get-ChildItem and then pipe into Remove-Item. This may also help if you deleting large folder structures.

Get-ChildItem $directoryPath -Recurse | Remove-Item -Force   

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)