ASKER
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set root=C:\Local\test
set After=%root%\After
set Before=%root%\Before
set BeforeTest=%root%\BeforeTest
pushd %Before%
for /r %%a in (*) do (
set AFile=%%a&set BFile=%%a&set CFile=%%a
set AFile=!AFile:Before=After!
set CFile=!CFile:Before=BeforeTest!
if exist "!AFile!" (call :DoIt "!CFile!")
)
popd
goto :eof
:DoIt
set CDir=%~dp1
if not exist "%CDir%" md "%CDir%"
copy "!BFile!" "%CDir%">nul
goto :eof
ASKER
This topic area includes legacy versions of Windows prior to Windows 2000: Windows 3/3.1, Windows 95 and Windows 98, plus any other Windows-related versions including Windows Mobile.
TRUSTED BY
Make a .bat file of this code.
Run it in a CMD window.
Notes:
- Change set root= to the folder above FolderA and FolderB. I used C:\Local\test
- This version ECHOs the MD and COPY commands. To run it for real, remove the ECHO prefixes from each in the :DoIt section.
Open in new window