Home > front end >  I get broken archive when I download to the folder
I get broken archive when I download to the folder

Time:04-07

I get right archive when I used command:

    wget https://mysite/published/my_archive.tar.gz

I can open this archive and use.

But I create fofder for archive

drwxr-xr-x   folder_for_archive

and used command for download archive to the folder:

wget https://mysite/published/my_archive.tar.gz -o "./folder_for_archive/https://mysite/published/my_archive.tar.gz"

But archive is broken and I cannot use it. What can I do?

CodePudding user response:

The -o argument to wget doesn't do what you think it does:

-o logfile
--output-file=logfile
Log all messages to logfile. The messages are normally reported to standard error.

Either replace wget by curl (whose -o option does do what you expect), or use -O (capital letter O) instead:

-O file
--output-document file
The documents will not be written to the appropriate files, but all will be concatenated together and written to file.

Notice the use of plural "documents": wget is a recursive downloader, so it might produce more than one file. But in your case, it should be fine.

See the wget manual for more information on both options.

  •  Tags:  
  • bash
  • Related