Extreme NewBie here

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Tizi1965
Posts: 1
Joined: 15 Dec 2022 02:06

Extreme NewBie here

#1 Post by Tizi1965 » 15 Dec 2022 02:17

Howdy all,
not sure how to go about this, hope someone can guide me ( not spoon feed ).......
i have a drive full of movies, each movie has a parent folder and a subs folder.
example : c:\diehard\subs\english.srt
what i would like to learn and do is to copy contents from sub and rename with movie title.
then move srt file to parent dir once completed delete subs folder.

cheers 8) 8) 8)

Lucky4Me
Posts: 24
Joined: 21 Oct 2020 06:33

Re: Extreme NewBie here

#2 Post by Lucky4Me » 18 Dec 2022 07:46

Code: Select all

for /r %%f in (*.avi,*.mp4,*.mkv) do (
if exist "%%~dpfsubs\english.srt" copy "%%~dpfsubs\english.srt" "%%~dpf%%~nf.srt"
if exist "%%~dpf%%~nf.srt" rd /S /Q "%%~dpfsubs"
)
This should do the job for avi, mp4 and mkv files.

It searchs the subs folder for english.srt, then copy the file to the film folder with the same filename of the film and then removes the subs folder with everything in it.
Added a safty, so it wouldn't remove the subs folder if there's no srt next to the film.

Post Reply