Spread the love

This post explains how to delete files and folders using PowerShell command ‘Remove-Item’. Also we are going to cover deleting of multiple files and removing files with wild characters.

For a single file:

Remove-Item test.txtCode language: CSS (css)

For multiple files:

Remove-Item test1.txt test2.txt test3.txtCode language: CSS (css)

For files with wild characters

Remove-Item *.txt
or 
Remove-Item *.xls
and so onCode language: CSS (css)

To delete a directory

Remove-Item foldertodelete

It will ask you if you want to delete the whole content select “Y” for yes and press enter.

Leave a Reply