• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

How to download files automatically from https website?

I get Zip file (containing 4 to 5 txt files) daily from a https secure website. I need to double click that zip file and save in my local disk and unzip to get the files. I want to make it automate as this is a daily process. How can I achieve this?
0
GouthamAnand
Asked:
GouthamAnand
  • 4
  • 3
1 Solution
 
giltjrCommented:
under Unix you should be able to schedule a task using cron to execute the command wget https://hostname/location-of-file/file.name
0
 
TintinCommented:
Assuming your version of wget or curl has SSL support, you can do something like
#!/bin/sh
cd /download/dir
wget https://example.com/file.zip
unzip file.zip

Open in new window

0
 
GouthamAnandAuthor Commented:
The website has username and password. I need to pass those. How can I do that?  Do I need to do anything to execute the command wget  or will it be executed(in korn shell). Once the shell script is ready successfull in downloading then I make it to run daily by scheduling.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TintinCommented:
I've updated the script to specify username/password and added some error checking.


#!/bin/sh
cd /download/dir
wget --user=username --password=yourpassword https://example.com/file.zip
 
if [ $? -eq 0 ]
then
   unzip file.zip
else
   echo "wget failed"
fi

Open in new window

0
 
GouthamAnandAuthor Commented:
But it is giving error "wget: not found. wget failed"
0
 
TintinCommented:
What Unix/Linux flavour are you on?  

Can you install additional software if needed?

What is the result of:

which curl


0
 
GouthamAnandAuthor Commented:
I am using HP-UX

I can install additional software if needed.

result fo which curl is
no curl in /u1010/...(some long path is here)


.
0
 
TintinCommented:
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now