Like to change my Batch file from rename/stripping filename (today below) to copy the filename complete from an existing movie file (which can be .avi, .mov, .mp4) which always get dropped as pair in a folder under “Temp” before I move the JPEG-file away.
@echo off
setlocal enabledelayedexpansion
set "sourcepath=C:\Temp"
set "folderpath=C:\master"
cd /d %sourcepath%
for /f %%a in ('dir /b "*.jpg"') do (
set "fname=%%~na"
ren "%%a" "!fname:~0,-9!.jpg"
)
for /F "delims=" %%a in ('dir /b /od "%sourcepath%\*.jpg"') do (
set "youngest=%%a"
move /y "%sourcepath%\!youngest!" "%folderpath%"
)
endlocal
Example could be:
C:\Temp\name1
09010203.mp4 and test.jpg, where the JPEG should change filename to 09010203.jpg, before I move it.