I wrote the code and I want to use it for my archive. Thanks for helping me improve it.
The folders containing the files are as follows (ex.):
Got/S01, s02 ,…
/S01/01.mkv, 02.mkv,…, cover.jpg
/S02/01.mkv, 02.mkv,…, cover.jpg
…
In each subfolder there is a file named cover.jpg that I want to attach to all the files in that folder but I can not modify my code to work properly (The written code could not identify the cover.jpg in each folder).
The batch file: https://drive.google.com/file/d/1GeK3yQSYKviWFjUxA3dunDk6sgbR0eD1/view?usp=sharing
Code:
For /R %%A IN (*.mkv) Do ("C:/Program Files/MKVToolNix\mkvmerge.exe" -o "%%~dpnxAtmp" --no-attachments --no-chapters --no-global-tags --no-subtitles --title ^"^" --language 0:und --language 1:en --track-name 0: --track-name 1: "%%~fA" --attachment-name cover.jpg --attachment-mime-type image/jpeg --attach-file "%*cover.jpg" & if errorlevel 2 (echo errors generated during remuxing, original file not deleted) else if errorlevel 1 (del /f "%%~fA" echo Warnings generated during remuxing to "%%~A", original file deleted) else (del /f "%%~fA" echo Successfully remuxed to "%%~A", original file deleted) & for /R %%A IN (*.mkvtmp) do ren "%%~fA" "%**.mkv" & CLS)
pause