Solved

How to download files automatically from https website?

Posted on 2009-05-12
8
406 Views
Last Modified: 2013-11-14
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
Comment
Question by:GouthamAnand
  • 4
  • 3
8 Comments
 
LVL 57

Expert Comment

by:giltjr
Comment Utility
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
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
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
 

Author Comment

by:GouthamAnand
Comment Utility
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
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:GouthamAnand
Comment Utility
But it is giving error "wget: not found. wget failed"
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
What Unix/Linux flavour are you on?  

Can you install additional software if needed?

What is the result of:

which curl


0
 

Author Comment

by:GouthamAnand
Comment Utility
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
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
Comment Utility
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now