Failing to write the file after the download completed #396

Closed
opened 2026-02-20 23:02:52 -05:00 by deekerman · 6 comments
Owner

Originally created by @niyazpk on GitHub (Nov 23, 2012).

Command:

youtube-dl -cil http://www.youtube.com/watch?v=f7AU2Ozu8eo&feature=relmfu

Error:

[youtube] Setting language
[youtube] f7AU2Ozu8eo: Downloading video webpage
[youtube] f7AU2Ozu8eo: Downloading video info webpage
[youtube] f7AU2Ozu8eo: Extracting video information
[download] Destination: Fluent 2012: Paul Irish, "Javascript Development Workflow of 2013"-7AU2Ozu8eo.mp4
[download] 100.0% of 262.58M at  398.71k/s ETA 00:00
ERROR: unable to rename file
'feature' is not recognized as an internal or external command,
operable program or batch file.

This BTW has created an empty file named Fluent 2012 in the folder.

Also if the download is interrupted for some reason, it is unable to resume the download later. (Fails with the same error)

(Windows)

Originally created by @niyazpk on GitHub (Nov 23, 2012). Command: ``` youtube-dl -cil http://www.youtube.com/watch?v=f7AU2Ozu8eo&feature=relmfu ``` Error: ``` [youtube] Setting language [youtube] f7AU2Ozu8eo: Downloading video webpage [youtube] f7AU2Ozu8eo: Downloading video info webpage [youtube] f7AU2Ozu8eo: Extracting video information [download] Destination: Fluent 2012: Paul Irish, "Javascript Development Workflow of 2013"-7AU2Ozu8eo.mp4 [download] 100.0% of 262.58M at 398.71k/s ETA 00:00 ERROR: unable to rename file 'feature' is not recognized as an internal or external command, operable program or batch file. ``` This BTW has created an empty file named `Fluent 2012` in the folder. Also if the download is interrupted for some reason, it is unable to resume the download later. (Fails with the same error) (Windows)
deekerman 2026-02-20 23:02:52 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@niyazpk commented on GitHub (Nov 23, 2012):

I assume it has something to do with the : in the title...?

@niyazpk commented on GitHub (Nov 23, 2012): I assume it has something to do with the `:` in the title...?
Author
Owner

@Plaque-fcc commented on GitHub (Nov 24, 2012):

No matter, weird but still funny error this is.

You should put the URI in single quotes since it contains the
ampersand sign.

@Plaque-fcc commented on GitHub (Nov 24, 2012): No matter, weird but still funny error this is. You should put the URI in single quotes since it contains the ampersand sign.
Author
Owner

@Plaque-fcc commented on GitHub (Nov 24, 2012):

And yes, you should customize the title, since there is yet no general
«all safe» nor «win32/NTFS»|«FAT32»|whatever naming policy control
options.

@Plaque-fcc commented on GitHub (Nov 24, 2012): And yes, you should customize the title, since there is yet no general «all safe» nor «win32/NTFS»|«FAT32»|whatever naming policy control options.
Author
Owner

@niyazpk commented on GitHub (Nov 24, 2012):

Ok... The way I understand it, there is no way around the & being there in the URL. I will have to quote the whole URL. Is that correct? If that is the case there is nothing much to be done for that case.

But the first problem remains I guess. Can we try something like warning the user before starting the download in cases like this? It'll be way better than waiting for the download to finish and then realize that the file cannot be written.

@niyazpk commented on GitHub (Nov 24, 2012): Ok... The way I understand it, there is no way around the `&` being there in the URL. I will have to quote the whole URL. Is that correct? If that is the case there is nothing much to be done for that case. But the first problem remains I guess. Can we try something like warning the user _before_ starting the download in cases like this? It'll be way better than waiting for the download to finish and then realize that the file cannot be written.
Author
Owner

@Tailszefox commented on GitHub (Nov 25, 2012):

You can just remove the ampersand, since it's not useful to get to the video. Quoting the whole URL will also work, but you'll have to do one or the other, as this has to do with the way the shell interprets the command before sending it to youtube-dl.

As for the issue with the semicolon, as @Plaque-fcc said, you should customize the title yourself. Using -l will give you the literal title, the whole point of it being to get the title as is, even if it creates an invalid filename. If you want to get a more "safe" filename, you can use, for example, -o '%(stitle)s.%(ext)s'. In your example, it gives us a file named Fluent 2012 - Paul Irish, 'Javascript Development Workflow of 2013'.mp4 which shouldn't pose any issue.

You can also use -t instead of -l: in this case, youtube-dl will use the title of the video as the filename but will filter it before to remove invalid characters. It's an easier way if you don't want to have to customize the title.

The -o and -t options aren't failproof since there's a lot of filesystems with a lot of differing restrictions regarding characters than can be used or not, but it should work most of the time, while the -l will always give you trouble for videos like this given that its intended purpose is to give you a literal title, without any filtering or checking.

@Tailszefox commented on GitHub (Nov 25, 2012): You can just remove the ampersand, since it's not useful to get to the video. Quoting the whole URL will also work, but you'll have to do one or the other, as this has to do with the way the shell interprets the command before sending it to youtube-dl. As for the issue with the semicolon, as @Plaque-fcc said, you should customize the title yourself. Using -l will give you the literal title, the whole point of it being to get the title as is, even if it creates an invalid filename. If you want to get a more "safe" filename, you can use, for example, `-o '%(stitle)s.%(ext)s'`. In your example, it gives us a file named `Fluent 2012 - Paul Irish, 'Javascript Development Workflow of 2013'.mp4` which shouldn't pose any issue. You can also use -t instead of -l: in this case, youtube-dl will use the title of the video as the filename but will filter it before to remove invalid characters. It's an easier way if you don't want to have to customize the title. The -o and -t options aren't failproof since there's a lot of filesystems with a lot of differing restrictions regarding characters than can be used or not, but it should work most of the time, while the -l will always give you trouble for videos like this given that its intended purpose is to give you a literal title, without any filtering or checking.
Author
Owner

@FiloSottile commented on GitHub (Nov 25, 2012):

OK, I think this boils down to the usual "quote the url, always" (as everything you type on the shell) and use -t, NOT -l. Do this and every video will download fine on every filesystem (almost sure, and if it doesn't, then it's a bug).

That being said, @phihag please let's alias -l to -t. There's no reason one should use -l anymore, if not by mistake.

@FiloSottile commented on GitHub (Nov 25, 2012): OK, I think this boils down to the usual "quote the url, always" (as everything you type on the shell) and use `-t`, NOT `-l`. Do this and every video will download fine on every filesystem (almost sure, and if it doesn't, then it's a bug). That being said, @phihag please let's alias `-l` to `-t`. There's no reason one should use `-l` anymore, if not by mistake.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#396
No description provided.