CODE: [Copy to clipboard]@echo off for %%a in ("C:\test\*.txt") do ( if "%%~nxa" neq "xx.txt" ( del /q /f "%%a" ) )