Commands / Files

Remove-Item

Delete a file or folder

beginner Files Aliases deleraserdrirmrmdir

Remove-Item
 Remove-Item -Path .\temp\old.log
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Remove-Item

Careful: There is no recycle bin. Deleted is gone. Use -WhatIf.

Deletes files or folders. Folders with contents need -Recurse. Some hosts also ask for -Force.

Try this

Remove-Item -Path .\temp\* -WhatIf

Coming from another shell

ShellWhat you might type
bash / zshrm -rf temp/
cmd.exermdir /s /q temp

Remove -WhatIf only when the preview looks right.

More in From bash and From cmd.

Related commands