There are 4 folders under my E drive. Can I create a batch script to protect these 4 folders from being deleted and automatically delete redundant files and folders?
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
for /f "delims=" %%i in ('dir /a /b e:\') do (
set flag=
for /f "delims=" %%j in (test.txt) do if /i "%%i"=="%%j" set flag=1
if not defined flag echo "e:\%%i"
)
pause
Folder 1
Folder 2
Folder 3
Folder 4
@echo off
for /f "delims=" %%i in ('dir /a /b e:\') do (
set flag=
for /f "delims=" %%j in (test.txt) do if /i "%%i"=="%%j" set flag=1
if not defined flag del /a /f "e:\%%i" 2>nul||rd /s "e:\%%i" 2>nul
)
pause
| Rater | Score | Time |
|---|---|---|
| ccwan | +5 | 2006-12-25 23:10 |