Send to File System
Sends a file to 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.
uploadStorage --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
)
- Connect to Dropbox (
-
Use a valid storage provider connection. See Storage providers for more information.
-
The full path of the source file must contain the file extension.
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 |
Connection variable to a file system. If nothing is specified in this parameter, the operating system's local file system is used by default. |
Source | source |
Required |
Text |
Enter the full file path, including the file extension to be sent. |
Target | target |
Required |
Text |
Enter the full destination file path to save the file. |
Example
Example 1:
This example uploads a PDF file to the books
folder on the target storage provider.
defVar --name drive --type FileSystem
defVar --name books --type String
googleDriveConnect --name googleDrive drive=value
createDir --path "/books" --fileSystem ${drive} books=value
uploadStorage --fileSystem ${drive} --source "C:\\Users\\UserName\\Documents\\name_of_the_book.pdf" --target "${books}/book.pdf"
Example 2:
This example gets many PDF files from the "My Documents" folder and uploads them to the target 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
// Gets PDF files from the My Documents folder
getFiles --path "${myDocs}" --recursive --filemask "*.pdf" files=value
foreach --collection "${files}" --variable "${file}"
// Gets the filename to use in the Target parameter
getFileInfo --path "${file}" filename=name
// Uploads the current file to the storage provider
uploadStorage --fileSystem ${drive} --source "${file}" --target "/pdfs/${filename}"
logMessage --message "Uploading ${file}" --type "Info"
endFor
Limitations
- For Microsoft™ OneDrive, use only forward slash (
/
) to separate paths. For other providers, you might need to use slash (/
) or escaped forward slash (\/
). - For Microsoft™ OneDrive, fill the Target and Source parameters using the full path to the file.