根据文件名创建文件夹:
@echo off
@for /f "tokens=5 delims=_ " %%i in ('dir w:*.zip ^| findstr zip') do set var=%%i
rem @set var=%var: =%
echo %var%
rem cd /d D:
rem if exist "%var%" rmdir /S /Q "%var%"
rem mkdir %var%
拷贝:
rem xcopy w: /E/H D:\%var%
判断文件夹中子文件夹的个数
rem 包含文件夹和文件数
@echo off
for /f "delims=" %%i in ('dir /b') do (set /a a+=1)
echo %a%
pause>nul
rem 此下面只文件夹数
@echo off
for /f "delims=" %%i in ('dir /a:d /b') do (set /a a+=1)
echo %a%
pause>nul
rem 此下面只文件数
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /a:-d /b') do (set /a a+=1)
echo %a%
pause>nul