标题: [文件操作] [分享]查找当前文件夹下全级次的空白子文件夹 [打印本页]
作者: hfxiang 时间: 2022-9-26 10:53 标题: [分享]查找当前文件夹下全级次的空白子文件夹
- @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!" 是空文件夹
- )
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |