Random Image Extraction from a folder by Bash Script
@echo off
setlocal
:: Initialization
set "ext=jpg"
set "source=folder 1"
set "target=folder 2"
:: Get count of images and select random image
for /f %%N in ('dir /b "%source%\*.%ext%"^|find /c /v ""') do (
set /a "imageNum=%random% %% %%N"
)
:: Copy the image
if %imageNum% gtr 0 (set "skip=skip=%imageNum%") else set "skip="
for /f "%skip% eol=: delims=" %%F in ('dir /b "%source%\*.%ext%"') do (
echo copy /y "%source%\%%F" "%target%\1.%ext%"
exit /b
)
shuf -zn8 -e *.jpg | xargs -0 cp -vt target/
답글삭제요런 방법도 있음 ~