Code:
@ECHO OFF
Set dir=test
echo.
Echo Setting: "%dir%" as Directory within the Folder that you want to delete
echo -----------------------------------------------------------------------
::now delete your specified Folders
@del %dir%\aaa /F /Q
@del %dir%\bbb /F /Q
@del %dir%\ddd /F /Q
echo.
echo.
Echo Deleting all folders from: "%dir%" except CCC.
echo.
echo.
echo.
::and flush 'em
for /d %%p in (%dir%\aaa) Do rd /Q /S "%%p"
for /d %%p in (%dir%\bbb) Do rd /Q /S "%%p"
for /d %%p in (%dir%\ddd) Do rd /Q /S "%%p"
echo -----------------------------------------------------------------------
echo.
echo.
@echo All specified Folder deleted except CCC.
echo.
echo.
echo -----------------------------------------------------------------------
pause
Example:
Zippyshare.com - BatchExample_withFolders.rar
- - - - - - - - - - Beitrag nachträglich erweitert - - - - - - - - - -

Zitat von
pythonfreak
Code:
FOR /f "delims=" %%G in (folders.txt) DO RMDIR /s /q "%%G"
tried:
your example is not looking in "folders.txt" file.
your batch has erased all folders next to the batch file but not that pointers in the folders.txt itself.
not working here