Project Description
ADSrv (Auto Downloads Service) is a windows services (based on BITS) to add, remove and track downloads from several text files. Is created with .NET 4.0 (although easily adaptable to 3.5) and interact with the BITS service using the SharpBits.Base wrapper library.

Service Installation
Open a cmd with admin privilege and type: AutoDownloadsService.exe /install.
Then open the services managmente console (Services.msc) and start the service called AutoDownloadsService.

Service Uninstall
Open a cmd with admin privilege and type: AutoDownloadsService.exe /uninstall.

Configuring the service
As a .NET application, you can configure it throws the app.config. The same look like:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="check-interval" value="5.5"/>
        <add key="logs-file" value="downloads\logs.txt"/>
        <add key="downloads-input-files-regex" value=".*?\.urls"/>
        <add key="downloads-input-dir" value="downloads"/>
        <add key="downloads-output-dir" value="downloads"/>
    </appSettings>
</configuration>

So, until now, you have the chance to modfy 5 parameters:

  1. check-interval: The minutes you want to use as the inteval to precess and update the input files (5.5 minutes in this example).
  2. log-files: Path to the file where you want the app write the operations logs. Can be a relative or absolute path.
  3. downloads-input-files-regex: Regex pattern an input file has to match to be considered (in this case, any file with .urls extension).
  4. downloads-input-dir: Directory (relative or absolute path) to search for input file that match the previous regex.
  5. downloads-output-dir: Directory (relative or absolute path) to put the downloaded files.

 

Note: If the supplied paths does not exist the app will try to create it.

Important: Verify that the Network Service account have read an write access to the paths specified.


Valid input files syntax:
When an input file is loaded by the app, each line is treated as a download, and most have one of the following structures:

  • <remote uri> [<local file path>].
  • "<remote uri with spaces>" ["<local file path with spaces>"]
  • <remote uri>
  • "<remote uri with spaces>"
  • #Anything here because this line is a comment

Some examples:
http://downloads.server.com/file1.zip downloads-file1.zip (the remote file1.zip will be saved as downloads-file1.zip in the output directory).

"https://downloads.server.com/My Files/file1.zip" "C:\Users\Tom\My Downloads\downloads-file1.zip" (the remote file1.zip will be saved in the absolute path assigned).

"file://Notwork-Server/My Files/file1.zip" (the remote file1.zip will be saved as file1.zip in the outpur dir).

"file://Notwork-Server/My Files/file1.zip" "C:\Users\Tom\My Downloads\" (the remote file1.zip will be saved as file1.zip in the supplied directory).

Note: The URIs most be valid BITS ones, see BITS documentation for more information.

Please, enjoy it!!!!

Last edited Jun 15, 2011 at 3:05 PM by rpgkaiser, version 6