- @echo off&cd /d "%~dp0"
- set "out=lastfolderlist.txt"
- type nul>"%out%"
- for /f "delims=" %%a in ('dir /ad-h/b/s') do (
- set "fd="
- set "f="
- for /f "delims=" %%b in ('dir /a-h/b "%%~a\" 2^>nul') do (
- if exist "%%~a\%%~nxb\" (set /a fd+=1) else (set /a f+=1)
- )
- if not defined fd (
- if defined f (
- set "fdpath=%%~a"
- setlocal enabledelayedexpansion
- >>"%out%" echo;!fdpath:~20!
- endlocal
- )
- )
- pushd "%%~a\"
- dir /a-h/b >"%tmp%\t.t"
- copy /y "%tmp%\t.t" "eachfolder.txt" >nul
- popd
- )
- pause
- exit
复制代码
|