english Version:
Hi, i need an additional command that delete the original files, but not the files that did not match this command:
FOR %%A IN (*.mkv) DO mkvmerge -o "%%~nA (subbed).mkv" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.mp4) DO mkvmerge -o "%%~nA (subbed).mp4" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.avi) DO mkvmerge -o "%%~nA (subbed).avi" "%%~A" "%%~dpnA.srt"
This command creates from test.mkv + test.srt the file test.mkv (subbed)
The Following files test1.mkv, test2.mkv,etc. without .srt should not be deleted.
Deutsche Version:
Hi ich würde gerne zu folgenden Kommandos, ein Kommando haben zum löschen der original Dateien haben, allerdings sollen andere Dateien die noch keine .srt Datei nicht gelöscht werden:
FOR %%A IN (*.mkv) DO mkvmerge -o "%%~nA (subbed).mkv" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.mp4) DO mkvmerge -o "%%~nA (subbed).mp4" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.avi) DO mkvmerge -o "%%~nA (subbed).avi" "%%~A" "%%~dpnA.srt"
Das Kommando erstellt aus z.b. einer test.mkv + test.srt die Datei test.mkv (subbed)
Die Dateien test1.mkv, test2.mkv, usw. ohne .srt Dateien sollen aber nicht gelöscht werden.
Ich möchte quasi die quell Dateien löschen und nur die test.mkv (subbed) Dateien behalten, aber wenn andere Dateien ohne .srt Datei im Ordner sind sollen diese nicht gelöscht werden.
THX
Anomaly-XB-6783
delete command
Moderator: DosItHelp
Re: delete command
Anomaly-XB-6783 wrote:english Version:
Hi, i need an additional command that delete the original files, but not the files that did not match this command:
FOR %%A IN (*.mkv) DO mkvmerge -o "%%~nA (subbed).mkv" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.mp4) DO mkvmerge -o "%%~nA (subbed).mp4" "%%~A" "%%~dpnA.srt"
FOR %%A IN (*.avi) DO mkvmerge -o "%%~nA (subbed).avi" "%%~A" "%%~dpnA.srt"
This command creates from test.mkv + test.srt the file test.mkv (subbed)
The Following files test1.mkv, test2.mkv,etc. without .srt should not be deleted.
Which files do you want to delete?
-
- Posts: 4
- Joined: 15 Jan 2016 04:05
Re: delete command
hi, i want to delete the "test.mkv" and "test.srt" file, if a "test.mkv (subbed)" is created. If there is a "test1.mkv" file but no ".srt" file, the batch should just skip it (which is the batch currently do, but i don't know if it keep donig it, if there is a delete command.)
Example:
1.
test.mkv + test.srt = test.mkv (subbed)
(delete) (delete) (keep)
2.
test1.mkv
(keep, because there is no test1.srt.)
btw: sorry for my bad english, i can read and understand everything but i can't write very good.
THX
Example:
1.
test.mkv + test.srt = test.mkv (subbed)
(delete) (delete) (keep)
2.
test1.mkv
(keep, because there is no test1.srt.)
btw: sorry for my bad english, i can read and understand everything but i can't write very good.
THX
Re: delete command
Your English is good...
This should solve it - I think the 2nd part means you want to skip the mkvmerge process and keep those files, when there is no corresponding .srt file, and that's what the code below should do.
This should solve it - I think the 2nd part means you want to skip the mkvmerge process and keep those files, when there is no corresponding .srt file, and that's what the code below should do.
Code: Select all
@echo off
FOR %%A IN (*.mkv *.mp4 *.avi) DO if exist "%%~dpnA.srt" (
mkvmerge -o "%%~nA (subbed)%%~xA" "%%~A" "%%~dpnA.srt"
if exist "%%~nA (subbed)%%~xA" del "%%~A"
)
-
- Posts: 4
- Joined: 15 Jan 2016 04:05
Re: delete command
Hi, first of all thanks for your answer. But unfortunately this does not work. When I start the batch it opened up a window and it closed again immediately without doing anything.
greets
Anomaly-XB-6783
greets
Anomaly-XB-6783
Re: delete command
Try this modification:
Code: Select all
@echo off
FOR %%A IN (*.mkv *.mp4 *.avi) DO echo found "%%a"&if exist "%%~dpnA.srt" (
echo processing "%%a"
mkvmerge -o "%%~nA (subbed)%%~xA" "%%~A" "%%~dpnA.srt"
if exist "%%~nA (subbed)%%~xA" del "%%~A"
)
pause
-
- Posts: 4
- Joined: 15 Jan 2016 04:05
Re: delete command
Almost perfect. The video file got deleted but not the .srt file. But I've figured out that I just have to ad "%%~dpnA.srt" at the end and it worked fine. Thank you very very much. I've googled it so long before I found this forum here. Vielen Dank.
the code looks like this now:
the code looks like this now:
Code: Select all
@echo off
FOR %%A IN (*.mkv *.mp4 *.avi) DO echo found "%%a"&if exist "%%~dpnA.srt" (
echo processing "%%a"
mkvmerge -o "%%~nA (subbed)%%~xA" "%%~A" "%%~dpnA.srt"
if exist "%%~nA (subbed)%%~xA" del "%%~A" "%%~dpnA.srt"
)
pause