File Downloader

Version 1.12 (February 2010)
Copyright © 2004-2010, Noël DANJOU
All rights reserved.


Welcome

File Downloader is a small command-line tool that allows you to download one or more files from HTTP and FTP servers. It can be easily used in a script, a batch file or the Task Scheduler to automate file downloads.

Note: versions 1.10 and later are Unicode versions only which means that they only run in Windows 2000 and later. Windows 98 and ME are not supported anymore.

Table of Contents
Welcome
Package Content
Syntax
Authentication
Return Codes (ERRORLEVEL)
Status Codes
Known Issues
History
Latest Version
Registration
Redistribution
Contact Details

Package Content

The File Downloader package is provided as a compressed (zip) archive that holds a few files. The included files are described in the table below.

File Description
download.exe File Downloader program.
logenc.exe Credentials Encoder program (see Authentication).
wait.exe Program whose purpose is to wait for a specified time period or until any key is pressed. It is similar to the TIMEOUT command in Windows Vista and later. It is used in the sample.bat example.
sample.bat Script that shows a way to use download.exe in a batch file.
batch.txt Sample text file that shows how to use the /batch parameter to download many files in one call.
readme.htm This file.
license.htm File only included with the full version.

Syntax

File Downloader features many parameters, for a whole list of the supported parameters and a description, type the following command in a Command Prompt:

download /?

The simplest syntax only requires the URL of the file or the resource to download, e.g.:

download http://www.server.com/file.zip

This command downloads the file.zip file from the webserver at www.server.com and places it in the current folder. This simple syntax may not be enough though. For example, you may get the following error:

Could not get file time on server.

In this case, you have to append the /notime parameter. Note that you may also specify this parameter if you want the filetime of the created file to be the one of the local system and not the one of the server.

The /overwrite parameter may also be required if you get the following error because the file already exists in the destination folder:

Could not create destination file.

The syntax would then look like this:

download http://www.server.com/file.zip /notime /overwrite

This syntax tells File Downloader to ignore the filetime of the file on the server and to overwrite any existing file.zip file in the current folder.

If the URL does not contain a filename and the server does not suggest one, you will get the following error:

An output filename is required

In this case, you can specify a filename using the /output parameter. You may also use the /output parameter to override a default or a suggested filename or to choose an alternate destination folder. Here is an example:

download http://www.server.com/download.php?res=1 /notime /overwrite /output:"c:\download\file.zip"

Notes:


Authentication

When authentication is required on the server, you can pass the login and password to the program, either as clear-text or in an encrypted form.

Clear-text authentication

The clear-text login and password are simply passed as second and third parameters after URL, e.g.:

download <url> mylogin mypassword [...]

or using the /credentials parameter like this:

download <url> /credentials:mylogin,mypassword [...]

Encrypted authentication

If you prefer to use encrypted credentials so that no one can see the login and password, you first have to create a credential file using the provided logenc.exe program. This program takes the login and password as parameters and optionally a credential filename. If no filename is specified, the default filename (credentials.dat) is used, e.g.:

logenc mylogin mypassword

or with an alternate output filename:

logenc mylogin mypassword server.bin

You can then use the credential file with download.exe, e.g.:

download <url> [...] /credentials:credentials.dat

or

download <url> [...] /credentials:server.bin

Notes:


Return Codes (ERRORLEVEL)

When File Downloader is used in a batch file, you can use ERRORLEVEL to check the completion code returned by the program. The possible return codes are listed in the table below. See the sample.bat example for a way to test the return codes.

Code Description
0 Success.
1 Syntax error or help/registration information displayed.
2 Download failed.
3 Invalid URL.
4 Destination file or folder error.
5 System error (e.g. out-of-memory).
6 Batch file error.

Status Codes

The table below lists some of the status codes that may be reported when a download fails. The short description should give you some hints at what might be wrong.

For more information, please see Microsoft Knowledge Base article ID 943891.

Code Description
400 Syntax error.
401 Access denied.
403 Request forbidden.
404 Object not found.
500 Internal server error.

Known Issues


History

February 23, 2010 - Version 1.12 (build 88.2)

  • Adds a /utf8 parameter to enable UTF-8 support on some FTP servers (opts utf8).
  • Fixes "could not set working directory" error with some FTP downloads.
  • Fixes some possible issues with FTP downloads.
  • Batch files now accept parameters. The parameters in the batch file override the command-line parameters.
  • The /newest parameter can now be combined with the /subdir parameter to download the most recent file from multiple folders and sub-folders (FTP only).

April 22, 2008 - Version 1.11 (build 76.2)

  • Fixes some minor issues from the previous build.

April 9, 2008 - Version 1.10 (build 73.3)

July 16, 2007 - Version 1.09 (build 59.1)

May 30, 2007 - Version 1.09 (build 58.3)

May 11, 2007 - Version 1.09 (build 57.5)

May 23, 2006 - Version 1.08 (build 54.2)

April 11, 2006 - Version 1.08 (build 53.2)

January 6, 2006 - Version 1.07 (build 50.5)

December 6, 2005 - Version 1.07 (build 49.2)

November 4, 2005 - Version 1.07 (build 48.5)

October 10, 2005 - Version 1.07 (build 45.1)

August 22, 2005 - Version 1.06 (build 40.1)

August 6, 2005 - Version 1.06 (build 39.6)

July 23, 2005 - Version 1.06 (build 38.6)

June 24, 2005 - Version 1.05 (build 27.5)

April 19, 2005 - Version 1.04 (build 22.2)

April 8, 2005 - Version 1.04 (build 21.5)

March 30, 2005 - Version 1.04 (build 20.3)

March 24, 2005 - Version 1.03 (build 17.4)

March 8, 2005 - Version 1.02 (build 15.2)

January 26, 2005 - Version 1.02 (build 12.4)

December 2, 2004 - Version 1.01 (build 10.4)

November 4, 2004 - Version 1.01 (build 7.4)

August 3, 2004 - Version 1.0 (build 3.2)

August 2, 2004 - Version 1.0 (build 2.1)

July 30, 2004 - Version 1.0 (build 1.5)


Latest Version

The latest demo version of File Downloader is always available for download from this address:

http://noeld.com/programs.asp?cat=misc#download


Registration

The demo version of this application only features a subset of the parameters supported by the registered version. When advanced parameters are used with the demo version, a REGISTRATION REQUIRED message will be displayed and the parameters will be ignored.

To register, click the link just below and follow the instructions.

https://www.regnow.com/softsell/nph-softsell.cgi?item=4076-9

Alternatively, you can type the following command in a Command Prompt to open the registration page in the default browser:

download /register

Orders and delivery are handled by the Register Now company.


Redistribution

Computer magazine publishers are welcome to redistribute the demo application as-is on their complimentary or monthly CDs. Any other redistribution of the application with commercial products is strictly forbidden without my written permission. Please contact me for a license agreement (see Contact Details).


Contact Details

E-mail: webmaster@noeld.com

WWW: http://noeld.com/