I need a bat to delete all files with the RELATIVE name that are NOT contained in a text file
In the text file list.txt i have this:
C:\S-ATLANTICO-1\MEDIA\Innplay-Logo.mp4
C:\S-ATLANTICO-1\MEDIA\logo-FB_sep.png
C:\S-ATLANTICO-1\MEDIA\logo-news_sa.png
and the in the same folder have this files:
Innplay-Logo.mp4
logo-FB_sep.png
logo-news_sa.png
Carlos.jpg
Sapo.png
list.txt
So i need to delete the next files because not exist in list.txt
Carlos.jpg
Sapo.png
but i also MUST KEEP the LIST.TXT
i have tried this but without sucess
@echo off
setlocal
set "folder=C:\S-ATLANTICO-1\MEDIA"
set "excludeFile=C:\S-ATLANTICO-1\MEDIA\list.txt"
for /f "eol=: delims=" %%F in ('dir /b /a-d "%folder%" ^| findstr /vig:"%excludeFile%" ^| findstr /v /i "\list.txt"') do del "%folder%\%%F"
any one can help me with this.
Thanks