Daniel Selvan
Daniel Selvan

Reputation: 1149

rm -rf equivalent on Windows batch script

I want to delete multiple folders & files at once and the command should not broke even if some directories or files aren't preset. Also I use wildcards(*) to combine folder & file names.

I have the following command to delete folders in Ubuntu

rm -rf dist pkitree srktable cst_sign* cst_encrypt* *.log out

However when I try to do accompany the same in Windows batch like,

rd /s /q dist pkitree srktable cst_sign* cst_encrypt* *.log out 2> NUL

I still get error status and the wildcards are not recognised. Can someone help me achieving this behaviour in Windows as well?

Upvotes: 1

Views: 3270

Answers (1)

Philippe
Philippe

Reputation: 26727

You can try :

powershell -Command "Remove-Item -Recurse dist, *.log"

Upvotes: -1

Related Questions