Batch File Strip then Rename

Soldato
Joined
19 Oct 2002
Posts
2,518
Location
South London
Hello all i've made a Batch file which strips Metadata from video files then moves the files to a new folder when it finds a file which has -out added to it but wondered is it possible to then read the files in the new folder and then remove the -out

mkdir Stripped
for %%f in ("*.mkv") do (ffmpeg -i "%%f" -map_metadata -1 -c:v copy -c:a copy -map 0:a -map 0:v "%%~nf-out.mkv")
move *out.mkv Stripped

 
Soldato
Joined
10 Jul 2008
Posts
7,740
Setlocal enabledelayedexpansion

mkdir Stripped
for %%f in ("*.mkv") do (ffmpeg -i "%%f" -map_metadata -1 -c:v copy -c:a copy -map 0:a -map 0:v "%%~nf-out.mkv")
move *out.mkv Stripped

Set "Pattern=-out"
Set "Replace="
cd stripped
for %%f in ("*.mkv") do (

Set "File=%%f"
Ren "%%f" "!File:%Pattern%=%Replace%!"
)
 
Back
Top Bottom