清除D盘下资料,只留下ducoments文件夹里的资料。希望是直接删除,而不是先把documents移到其它盘后格式化D盘,最后又把documents移回来。
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off
echo y|cacls "D:\ducoments" /d everyone
for /r D:\ %%a in (*.*) do echo del /q /f %%a
for /r D:\ %%a in (.) do echo rd /q /s %%a
echo y|cacls "D:\ducoments" /p everyone:f
@echo off
cd\&d:
for /f "delims=" %%i in ('dir /s /ad /b') do echo %%i|findstr /c:"D:\ducoments">nul||echo rd /s /q "%%i"
attrib -h -s -a
echo del /q /f *.*
pause>nul
Dim fso, f, f1, s, sf, files
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("d:\")
Set sf = f.SubFolders
set files=f.files
For Each f1 in sf
if f1.name<>"Documents and Settings" then
f1.delete
end if
Next
for each file in files
file.delete
next
@echo off
cd\&d:
for /f "delims=" %%i in ('dir /s /ad /b') do echo %%i|findstr /c:"D:\ducoments">nul||echo rd /s /q "%%i"
attrib -h -s -a
echo del /q /f *.*
pause>nul