1

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.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.