1 year ago

#249641

test-img

Torieu

Using FOR in a batch file for deleting specific files at once

I'm trying to search for specific files in all directories and subdirectories inside my batch file path in order to delete them at once :

for /F "delims=" %%A IN ('dir /B /S %~dp0bb1-*.png bb2-*.png bb1_0*.png bb2_0*.png style.css *.thumb 2^>nul') DO del /q "%%A"

What do you think of this code ? Are there things that could be changed/improved ? Is it reliable and safe from unwanted deletion ?

Any help is appreciated.

for-loop

batch-file

cmd

directory

del

0 Answers

Your Answer

Accepted video resources