PowerShell: How To Delete Files and folders, multiple files and files with wild characters.

User Avatar
👤 admin
🔴 Admin
✍️ The most important thing in the world is to not be alone.
⏳ Last active: 15 Apr 2025 at 16:01
📅 Created: 16 Feb 2021 at 10:49
👀 Viewed: 18 times
✉️ Send Email

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.txt

For multiple files:


Remove-Item test1.txt test2.txt test3.txt

For files with wild characters


Remove-Item *.txt

or

Remove-Item *.xls

and so on

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.

https://youtu.be/e5BPb7i2Of0

If you want to comment: Login or Register