Got a question from Nathan:
“Steve, we have a file we need to download from a website once a week. Since I am the only one in the IT department, they have made it my job to get this file and put it on a public share every Friday. Is there any way I could download it automatically?”
That is a great question. There are a few ways you can do this, but my favorite is to use a free and open source tool called CURL.
It is a command line program that allows you to get web pages, and binary files from HTTP, HTTPS, and FTP servers.
You can download a free copy from here:
http://curl.haxx.se/latest.cgi?curl=win32-ssl
There are so many features and options, you could probably write a book on this tool. I will show just one way to use it.
Our friend Nathan wants to download a file from his batch file.
Lets say the URL of the file is
http://ftp.intelliadmin.com/setupex.exe
And we want to save it to
\\server1\public\data\setupex.exe
Our CURL command line would look like this in our batch:
curl --location http://ftp.intelliadmin.com/setupex.exe > \\server1\public\data\setupex.exe
That one line is all we need. The –location option tells CURL to follow redirects. Without it, if the target page is redirected, you will only get the redirect notice – not the file you wanted to download.
Add it to the task scheduler in Windows, and have it run once a week.
No more downloading for Nathan. He can spend his time reading my old blog articles 🙂
One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools
{ 4 comments… read them below or add one }
I use Wget for Windows
http://gnuwin32.sourceforge.net/packages/wget.htm for this task. It’s even easier to use since you don’t need to redirect the output or specify the target filename.
WGET http://ftp.intelliadmin.com/setupex.exe
is all you need. Put it in your path and you’re golden.
Great utility Steve. I have used this in Unix before, but did not think they made a version for Windows.
Thanks for the tip Angus…have used WGet in the past too…will have to download and take another look.
Steve
I too find wget much much easier to use than curl, at least in the “getting stuff from websites” space. It can handle simple authentication, self signed certificates, etc. as well.