@echo off
setlocal EnableDelayedExpansion
cd C:\Parent\Folder\OfFirstNumberedFolders
for /F "delims=" %%a in ('dir /B /S /A-D master.jpg') do (
set "fullName=%%a"
for /F "tokens=1-3 delims=\" %%b in ("!fullName:%CD%=!") do (
ECHO ren "%%a" "%%b_%%c_%%d"
)
)