- @echo off
- @REM 脚本与主文件夹同目录
- setlocal EnableDelayedExpansion
- cd /d "%~dp0"
- for /d %%A in (.\*) do (
- set dirname=%%~nxA
- if /i not "!dirname:~-5!"=="_随机采样" (
- xcopy "%%A" "%%A_随机采样\" /T /E /F
- for /d %%B in ("%%A\*") do (
- for /f "delims=" %%C in ('dir /a-d /b /s "%%B\*"^|powershell -c "get-random -input @($input) -count (Get-Random -Maximum 10 -Minimum 5)"') do (
- echo copy "%%C" "%%A_随机采样\%%~nxB\"
- copy "%%C" "%%A_随机采样\%%~nxB\"
- )
- )
- )
- )
- endlocal
- pause
- exit /b
复制代码
|