Copy File
Verb: fileCopy
Copies a file from one directory to another.
Syntax
fileCopy --from(String) --to(String) [--fileSystem(FileSystem)]
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--from | From | Required | Text | Path of the file that should be copied. |
--to | To | Required | Text | Directory path to where the file should be copied. |
--fileSystem | File System | Optional | File System | Connection variable to a file system.
1. To obtain the connection variable with an available file system, this connection must be established using one of the following commands: IBM RPA Control Center. 2. If nothing is specified in this parameter, the local file system of the operating system is used as default. |
Example
The Copy File command copies a file from the first prepared directory to the second one, which is empty.
defVar --name documentsPath --type String
defVar --name fileToCopyDirectory --type String
defVar --name copiedFileDirectory --type String
defVar --name fileToCopy --type String
// Preparing two folders, one with the file and one without.
getSpecialFolder --folder "MyDocuments" documentsPath=value
createDir --path "${documentsPath}\\fileWithDirectory" fileToCopyDirectory=value
createDir --path "${documentsPath}\\copiedFileDirectory" copiedFileDirectory=value
writeToFile --value "IBM-Automation" --file "${fileToCopyDirectory}\\fileToCopy.txt" fileToCopy=value
// Copy the file "fileToCopy.txt" in the "fileToCopyDirectory" folder to the "copiedFileDirectory" folder.
fileCopy --from "${fileToCopy}" --to "${copiedFileDirectory}"