I am downloading a file using the wget
command. But when it downloads to my local machine, I want it to be saved as a different filename.
For example: I am downloading a file from www.examplesite.com/textfile.txt
I want to use wget
to save the file textfile.txt
on my local directory as newfile.txt
. I am using the wget
command as follows:
wget www.examplesite.com/textfile.txt
Save with different file name By default, downloaded file will be saved with the last name mentioned in the URL. To save file with a different name option O can be used. Syntax: wget -O <fileName><URL>
If you specify the output file using the -O option it will overwrite any existing file.
If you want to download multiple files at once, use the -i option followed by the path to a local or external file containing a list of the URLs to be downloaded. Each URL needs to be on a separate line. If you specify - as a filename, URLs will be read from the standard input.
Use the -O file
option.
E.g.
wget google.com ... 16:07:52 (538.47 MB/s) - `index.html' saved [10728]
vs.
wget -O foo.html google.com ... 16:08:00 (1.57 MB/s) - `foo.html' saved [10728]
Also notice the order of parameters on the command line. At least on some systems (e.g. CentOS 6):
wget -O FILE URL
works. But:
wget URL -O FILE
does not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With