EDITED This is untested. It creates file.bat.txt
for you to check and then you can run it if it has the right folders in it. After you check file.bat.txt
and are happy with it then you can rename it to file.bat
and run it to remove the folders.
What the code below does is: create a list of all paths to any file named complete.txt under c:\list and then compares only the root folder
of every folder in the main folder. If the root folder is not found in the list then it echoes the RD command to remove it into file.bat.txt
@echo off
set "folder=c:\list"
if not defined folder goto :EOF
dir "%folder%\complete.txt" /b /s /a-d >temp.tmp
del file.bat.txt 2>nul
for /f "delims=" %%a in ('dir "%folder%" /b /ad ') do (
find /i "%folder%\%%a" <"temp.tmp" >nul || >>file.bat.txt echo rd /s /q "%folder%\%%a"
)
:del temp.tmp