In: Computer Science
Write a bash script to download two files, say file1.gz and file2.gz from a given web address to the directory "assignment5"
Here is the code for the given script.
wget https://ftp.gnu.org/gnu/wget/file1.gz -P assignment5
wget https://ftp.gnu.org/gnu/wget/file1.gz -P assignment5
We will use the wget to download two files, say file1.gz and file2.gz from a given web address to the directory "assignment5".
Since this file actually does not exist in the link, I have also given an example of the actuall file which gets downlaoded to the assignment5 folder for demonstration purpose.
wget -P
or
--directory-prefix
option is used to set the directory
prefix where all retrieved files and subdirectories will be saved
to.
Syntax is
wget linkaddressandfilenameattheend -P destinaionfolder
Wget is a popular, non-interactive and widely used network downloader which supports protocols such as HTTP, HTTPS, and FTP.
Output (as file does not exist its gives error.
Example for Actuall working of code when the link is working just to show the code works:
wget https://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz -P assignment5
wget https://ftp.gnu.org/gnu/wget/file1.gz -P assignment5
File get downloaded on assignment5 folder.
If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.
Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.