-
Notifications
You must be signed in to change notification settings - Fork 0
[BUG] Downloaded files not saved to Desktop, name includes path #7
Description
Bug Description
When running download_media.ps1 on Linux (e.g., Linux Mint 22.x), downloaded files are not saved correctly to the Desktop folder. Instead, the path to the Desktop is incorrectly included in the file name with backslashes , creating a single file with the path as part of the name in the /home/USER folder.
Steps to reproduce the behavior
1.Create a file named input.txt in the same directory as the script and add one or more media URLs (for example, a YouTube link).
2.Open PowerShell (pwsh) in the script directory.
3.Run the script using:
./download_media.ps14.Wait for the download to finish and check your Desktop folder.
5.Observe that the file name includes part of the Desktop path instead of being saved correctly into the Desktop folder.
Expected behavior
Files should be saved directly into the user's Desktop folder with the proper filename, e.g.:
/home/carlos/Área de trabalho/VideoTitle.webmActual behavior
The file is saved with the path included in the filename:
/home/carlos/Área de trabalho\VideoTitle.webm"home" and "carlos" is folder but "Área de trabalho\VideoTitle.webm" is the archive name
Screenshots/Output
**Environment (please complete the following **
OS: Linux Mint 22.2 (based on Ubuntu 24.04)
PowerShell Version: 7.5.3
yt-dlp Version: 2025.09.26
Input file content
https://www.youtube.com/watch?v=t5Ai50n8Muw
https://www.youtube.com/watch?v=yebh32JSs9g&list=RDyebh32JSs9g
https://youtu.be/t5Ai50n8Muw?si=9uHn0g0ZQhZWMMo6
Additional context
The issue appears because the script always uses a Windows-style path separator when building the output path for downloads.
On Linux systems, this causes yt-dlp to interpret part of the path as part of the file name (e.g., "Desktop\VideoTitle.webm").
To fix this, you could add OS detection logic and use the correct separator based on the platform.
Suggested changes:
# Detect OS
if ($IsWindows) {
$desktopPath = [Environment]::GetFolderPath("Desktop")
$separator = "\"
} else {
$desktopPath = "$HOME/Área de trabalho"
$separator = "/"
}
# Use the correct separator
$ytdlpArgs += "--output"
$ytdlpArgs += "$desktopPath$separator%(title)s.%(ext)s"