P
P
Pavel2017-08-02 09:33:04
cmd/bat
Pavel, 2017-08-02 09:33:04

How to delete files other than those containing ~ in extension via command line?

I have a script that deletes all files in the folder: del /q c:\myfolder\*.*, the problem is that the folder may contain a temp.~avi or temp.~wmw file, how can I do this so that if there is a "~" in the name after the dot, then did this file get deleted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Olgeir, 2017-08-02
@mrusklon

for /f %%a in ('dir /b /ad *.* ^| findstr /r /v "\.bat"') do del /q %%a

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question