Tariq Soliman
Tariq Soliman

Reputation: 59

Manually deleting multile files in Powershell?

Is it possible to delete multiple files with one command using powershell. i.e in unix you can do rm file1 file2 but when I try it in powershell I get "Remove-Item : A positional parameter cannot be found that accepts argument 'file2'". Same if I use del.

Upvotes: 1

Views: 49

Answers (1)

Odysseas Tsimpikakis
Odysseas Tsimpikakis

Reputation: 86

You can separate the file paths with a comma, like this.

Remove-Item "test1.txt", "test2.txt"

There are also options for using wildcard characters, like

Remove-Item "test*.txt"

this will remove all files that match the pattern.

You can check more details in the command's documentation

Upvotes: 3

Related Questions