Download file

Octopus.Script exported 2017-03-07 by ahmedig belongs to ‘HTTP’ category.

Downloads a file from the internet to the local machine.

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

File Url

FileUrl =

Url of the file you want to download

File Destination Path

FilePath =

Destination path of the file on disk

Script body

Steps based on this template will execute the following PowerShell script.

Write-Verbose "Downloading file $FileUrl, to the destination $FilePath" -Verbose
$client = new-object System.Net.WebClient
$client.DownloadFile($FileUrl, $FilePath)
Write-Verbose "File downloadded" -Verbose

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "f444ca63-a73c-4878-955e-96b508f9e883",
  "Name": "Download file",
  "Description": "Downloads a file from the internet to the local machine.",
  "Version": 3,
  "ExportedAt": "2017-03-07T05:12:43.174Z",
  "ActionType": "Octopus.Script",
  "Author": "ahmedig",
  "Parameters": [
    {
      "Id": "3e6a8f44-5791-4571-8e90-025f6776c6d0",
      "Name": "FileUrl",
      "Type": "String",
      "Label": "File Url",
      "HelpText": "Url of the file you want to download",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "1b67fd5f-f626-40f4-80bb-f10fe681abf3",
      "Name": "FilePath",
      "Type": "String",
      "Label": "File Destination Path",
      "HelpText": "Destination path of the file on disk",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    }
  ],
  "Properties": {
    "Octopus.Action.Script.Syntax": "PowerShell",
    "Octopus.Action.Script.ScriptSource": "Inline",
    "Octopus.Action.RunOnServer": "false",
    "Octopus.Action.Script.ScriptBody": "Write-Verbose \"Downloading file $FileUrl, to the destination $FilePath\" -Verbose\n$client = new-object System.Net.WebClient\n$client.DownloadFile($FileUrl, $FilePath)\nWrite-Verbose \"File downloadded\" -Verbose\n",
    "Octopus.Action.Script.ScriptFileName": null,
    "Octopus.Action.Package.FeedId": null,
    "Octopus.Action.Package.PackageId": null
  },
  "Category": "HTTP",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/file-download.json",
  "Website": "/step-templates/f444ca63-a73c-4878-955e-96b508f9e883",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB1dJREFUeNrsnc8uO18Yh1ERoRKJ+CYkLNljzwVwAXoBdQHs6V7t6wLaC+AC2GPPykJIxM6fECm/T3qS8zumM9PTabUz+jyr0Z7OTOc8877vnDlTw9/f30MA3WYYsQCxALEAsTgKgFiAWIBYAIgFiAWIBYBYgFiAWACIBYgFiAWAWIBYgFgAiAWIBYgFgFiAWIBYAIgFiAWIBYBYgFiAWACIBYgFiNXM19fX+/s7x25AGB8fHxkZafdTowm2JBfr9TpHfEBIltNGOHDwGyAWIBYgFiAWAGIBYgFiASAWIBYgFgBiAWIBYgEgFiAWIBYAYgFiAWIBIBYgFiAWAGIBYgFiASAWIBYgFkByRnu/ybe3N457hhgeHs7n8+kV6+vr6+npSVZNT0/ncjk6LCt8fHwkECvJD6/V6/V2o46suru7m52d/ffvH12VLWSIglZKxXp8fFSgmpmZoZ8GRKxeFO+fn58Kp1jFVWH3xVK44lgjFgBiAWIBYgEgFiAWIBYAYgFiAWIBIBYgFiAWAGJBahjNyo5eXl7a5aWlpampKTpPHBwc3N/fa2GrQWibarV6dnamhfn5ebVHrB/s7OzY5Uqlsrq62vk6n5+fb25uWq5KvbKxsZHCY6L9Pz09NcuFQiGqmdroaxqxSIW/js5jneJuIAwNk2qjlun8CiYOGaJOD3PyxLcZ6IjV3axaLpft4Y7qD7Ux8WBubi7l5UFMbeDK18u4O4gRS5k03iqhBjbLpBYrTYwxPvIhFvxQ/+XlpaVYPvIhFoQYk8/nFY06kQ+xIESsmJL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WsyFRo8pQ7ZLDUwA1mpk1UeDNqDjUm6hwdHYW2UUEdNdunZchM87OppML/pdnf3w+tUQIprPk/i6qDQ4t0NY6f+aR3lXaT3RJu99nUvhdYWYpYZip6aJ4KYOetx6DyWc3U03beUrNDZkZypVJxB4e0ZsWk5h3QK8qVMkAfCUQ1KaVs27KzA7vtziBt99nUNIjVi/+wqsb6SL/mb/we7tx59ye77AN9cqUrg0k+02C0RRNKu7VRS7L/sDqINdZvYyYZd3GFPmtL2+RHBkgBsQCxALEAEAsQCwYZhhuSs7W1Ze8OpfaXlfsFA6TQgmQDpKRCoMYCxALEAkAsQCxALIBsilWv1znWiNVlxsfHYx7mBMRKuo2RkcnJydvbWw734NCLWzqGx8dHbWtxcXFsbIzjniGS3dLpnVji9fVVOfH9/R23MsTExMTCwkKqxYKMipXL5RhugEEabgDEAkAsQCxALADEAsQCxAJALEAsQCwAxALEAsQCQCxALEAsAMQCxALEAkAsQCxALADEAsSCv0qSR+wBEAsQCxALALEAsQCxABALEAsQCwCxALEAsQAQCxALEAsAsQCxALEAEAsQCxALALEAsQCxABALEAsQCwCxALEAsQAQCxALMsV/AgwA3l1/9Yi7khIAAAAASUVORK5CYII=",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Tuesday, March 7, 2017