Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save buzztiaan/941e8df18a7d4b13dd4c92f51aa65581 to your computer and use it in GitHub Desktop.
Save buzztiaan/941e8df18a7d4b13dd4c92f51aa65581 to your computer and use it in GitHub Desktop.
copy latest 2 files from all subdirs
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET HENK=
SET TRUUS=
SET ROOT=%1
SET ROOT=%ROOT:~1%
SET ROOT=%ROOT:~0,-1%
SET TARGET=%2
SET TARGET=%TARGET:~1%
SET TARGET=%TARGET:~0,-1%
FOR /F "DELIMS==" %%d in ('DIR "%ROOT%" /AD /B /O-D') DO (
FOR /F "delims=|" %%I IN ('dir "%ROOT%\%%d\setup*exe" /A-D /-W /B /O:D') DO (
SET TRUUS=!HENK!
SET HENK=%%I
)
copy "%ROOT%\%%d\!TRUUS!" "%TARGET%"
copy "%ROOT%\%%d\!HENK!" "%TARGET%"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment