Download from File System
Downloads a file from a cloud file system.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
downloadStorage --fileSystem(FileSystem) --source(String) --target(String)
Dependencies
Use one of the following commands to connect to a storage provider:
- Connect to Dropbox (
dropboxConnect
) - Connect to Google Drive (
googleDriveConnect
) - Connect to Microsoft OneDrive (
oneDriveConnect
)
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
File System | fileSystem |
Required |
File System |
File system connection variable. If nothing is specified in this parameter, the operating system's local file system is used by default. |
Source Path | source |
Required |
Text |
File path on the file system to be downloaded. |
Target Path | target |
Required |
Text |
Path to the location where the downloaded file should be saved. |
Example
Example 1:
This example downloads file.txt
from the storage provider.
defVar --name connection --type FileSystem
defVar --name fileSavePath --type String
// Starts the connection to the Google Drive service.
googleDriveConnect --name GoogleDrive connection=value
getSpecialFolder --folder "Desktop" fileSavePath=value
downloadStorage --fileSystem ${connection} --source "/file.txt" --target "${fileSavePath}/file.txt"
Example 2:
This example downloads all the PDF files from the storage provider:
defVar --name drive --type FileSystem
defVar --name files --type List --innertype String
defVar --name myDocs --type String
defVar --name file --type String
defVar --name filename --type String
dropboxConnect --name dropbox drive=value
getSpecialFolder --folder "MyDocuments" myDocs=value
getFiles --path "/" --recursive --filemask "*.pdf" --fileSystem ${drive} files=value
foreach --collection "${files}" --variable "${file}"
getFileInfo --path "${file}" filename=name
downloadStorage --fileSystem ${drive} --source "${file}" --target "${myDocs}\\${filename}"
logMessage --message "Downloading ${filename}" --type "Info"
endFor