- @echo off
- @rem 保存为ANSI格式
- @rem 查找当前文件夹下全级次的空白子文件夹
- cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "Previous_Folder=%~dp0"
- for /f "delims=" %%a in ('dir/b/s/ad^|sort') do (
- set "Current_folder=%%a"
- call set "dif_str=%%Current_folder:!Previous_Folder!=%%
- if "!dif_str!" equ "%%a" call :Process_Empty_Folders
- set "Previous_Folder=!Current_folder!"
- )
- :Process_Empty_Folders
- set "Empty_Folder="
- for /f "delims=" %%b in ('dir/a/b "!Previous_Folder!"') do (
- set "Empty_Folder=%%b"
- )
- if "!Empty_Folder!." equ "." (
- echo "!Previous_Folder!" 是空文件夹
- )
复制代码
|