How to set the output file of wget?

wget application

Wget is a popular application for downloading a file or a content via direct link and store it on a local storage.

The usage of wget is as follows:

wget https://example.com/my-file

However, in some cases, we are not happy with the name of the generated file and we would prefer to set the name of the target file.

In some cases, it might be even worse and the name of file does not fit to the requirement of a file name and might be rejected straight away:

HTTP request sent, awaiting response... 200 OK
Length: 24569672 (23M) [video/mp4]
myfile.mp4?auth=True.ABCD.EFG: Invalid argument

Cannot write to 'myfile.mp4?auth=True.ABCD.EFG’ (Success).

Thus, we need to specify the target file name by ourselves to resolve such problems.

Setting the wget target file name

The solution to fix this problem is to use -O as a parameter followed by the file name. Please note that here the O is capital!

An example would be:

wget https://example.com/my-file -O custom-file-name.mp4
linux
ubuntu
cli
Software and digital electronics / IT
Posted by landi
2024-04-08 22:10
×

Login

No account?
Terms of use
Forgot password?