Created
July 6, 2017 14:07
-
-
Save buzztiaan/941e8df18a7d4b13dd4c92f51aa65581 to your computer and use it in GitHub Desktop.
copy latest 2 files from all subdirs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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