Move File

Verb: fileMove

Moves the file from one directory to another.

Syntax

fileMove --from(String) --to(String) [--fileSystem(FileSystem)] (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--from From Required Text Full path of the file to be moved.
--to To Required Text Full directory path to where the file should be moved.
--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.

Outputs

Script Designer AcceptedTypes Description
value Success Boolean Returns "True" if the file has been moved, or "False" if the file has not been moved.

Example

Two directories are prepared: "createdDirectory" (has a file named "FileToMove.txt") and "movedFileDirectory" (has no files). After creating the directories, the Move File command moves the file "fileToMove.txt" from one directory to another, returning a boolean that tells you if the operation was successful.

defVar --name documentsPath --type String
defVar --name movedFileDirectory --type String
defVar --name success --type Boolean
defVar --name createdDirectory --type String
defVar --name fileToMove --type String
getSpecialFolder --folder "MyDocuments" documentsPath=value
createDir --path "${documentsPath}\\createdDirectory" createdDirectory=value
createDir --path "${documentsPath}\\movedFileDirectory" movedFileDirectory=value
writeToFile --value "IBM-Automation." --file "${createdDirectory}\\fileToMove.txt" fileToMove=value
fileMove --from "${fileToMove}" --to "${movedFileDirectory}" success=value
logMessage --message "File successfully moved: ${success}" --type "Info"
// After running the script, the result is:
// File successfully moved: True.

See Also

  • Check If Directory Exists
  • Convert Base64 to File
  • Convert File to Base64
  • Copy File
  • Count Files
  • Create Directory
  • Delete Directory
  • Delete File
  • Delete from Directory
  • Download from File System
  • Get Directories
  • Get Files
  • If File Exists
  • Read All Bytes
  • Read All Text
  • Rename File
  • Send to File System
  • Write to File