After reading some of the documentation and playing around with youtube-dl
a bit, based on your script I can see the problem. If you want the downloaded file(s) in a specific location, you must specify that location in the -o
section before the file name. Here's an example:
Code:
C:\Testydl\youtube-dl -f best "https://www.youtube.com/watch?v=qVEYJ0PxhZU" -o "Family guy - Every Pizza Place.mp4"
The code above will download the best quality video from the youtube url entered and name it 'Family guy - Every Pizza Place.mp4' in the same directory as the youtube-dl
executable file, this is similar to your code.
Now say you wanted to download the video to a folder called 'Family Guy Videos' that's location in the same path as youtube-dl.exe
, the code would then look like this:
Code:
C:\Testydl\youtube-dl -f best "https://www.youtube.com/watch?v=qVEYJ0PxhZU" -o ".\Family Guy Videos\Family guy - Every Pizza Place.mp4"
Now lets say that the 'Family Guy Videos' folder was located in another path than where youtube-dl.exe
is located or is even in a different drive/partition altogether, in that case you will want to use an absolute path instead and the code may look like this:
Code:
C:\Testydl\youtube-dl -f best "https://www.youtube.com/watch?v=qVEYJ0PxhZU" -o "C:\Users\Admin\Videos\Family Guy Videos\Family guy - Every Pizza Place.mp4"
Or
Code:
C:\Testydl\youtube-dl -f best "https://www.youtube.com/watch?v=qVEYJ0PxhZU" -o "E:\My Videos\YouTube\Family Guy Videos\Family guy - Every Pizza Place.mp4"
An example of a basic batch script with the above info in mind:
Code:
@echo off
goto INIT
:INIT
title my ydl script
cls
setlocal
if exist C:\Testydl set PATH=%YDL_PATH%;C:\Testydl
goto BATCH_JOB
:BATCH_JOB
echo.
youtube-dl -f best "https://www.youtube.com/watch?v=qVEYJ0PxhZU" -o "E:\My Videos\YouTube\Family Guy Videos\Family guy - Every Pizza Place.mp4" >nul
if exist "E:\My Videos\YouTube\Family Guy Videos\Family guy - Every Pizza Place.mp4" echo. " [Family guy - Every Pizza Place.mp4] > [E:\My Videos\YouTube\Family Guy Videos] "
youtube-dl -f best "https://www.youtube.com/watch?v=74-HJkYCaVc" -o "E:\My Videos\YouTube\Family Guy Videos\Family Guy - Joe Arrests His Son !.mp4" >nul
if exist "E:\My Videos\YouTube\Family Guy Videos\Family Guy - Joe Arrests His Son !.mp4" echo. " [Family Guy - Joe Arrests His Son !.mp4] > [E:\My Videos\YouTube\Family Guy Videos] "
echo.
echo. Press Any Key To Continue...
pause>nul
goto PROG_EXIT
:PROG_EXIT
exit