What is the best way to delete ALL files in a specific that DO NOT have a certain string as a PREFIX:
String : CC_NEQ
Thanks!
For loop Delete question
Moderator: DosItHelp
Re: For loop Delete question
Untested:
Remove ECHO and PAUSE if it displays the right files to delete.
Steffen
Code: Select all
@echo off &setlocal
set "folder=C:\test"
set "prefix=CC_NEQ"
pushd "%folder%"
for /f "delims=" %%i in ('dir /a-d /b ^|findstr /vbc:"%prefix%"') do ECHO del /f "%%i"
popd
PAUSE
Remove ECHO and PAUSE if it displays the right files to delete.
Steffen
Re: For loop Delete question
Works great, thank you sir!!!