Skip to main content
Kofax

How to write a file to a remote host

Summary 

13240

Writing a file is done using the "Write File" step and specifying the whole path to the file under "File Name".

In Windows, depending on the "File Name", the robot can write files locally or on a remote host: E.g.

  • C:\Temp\MyFile.txt will write a file locally
  • \\MyServer\Files\MyFile.txt will write the file to the remote host named MyServer (alternatively, the server's IP can be used)
  • Z:\Files\MyFile.txt can be used too, when Z:\ is a mapped drive to another machine.

Notes:

  1. Knowledgebase article #12439: When RoboServer is installed as a Windows Service, robots may fail on steps configured to use mapped network drives
  2. The drive letter needs to exist on the machine where the RoboServer is running (when the robot is run here). Otherwise, the Write File step will fail because the path can't be found

In Linux, the Write File step needs to be given a Linux path (e.g. /tmp/MyFile.txt). Please note that Linux will not throw an error if the robot wants to create a file with the name C:\Temp\MyFile.txt.
When creating a file in linux, you can give it a name that contains backslashes and the file will be created, but the backslashes removed (e.g. vi C:\Temp\MyFile.txt will create a file called C:TempMyFile.txt in the folder from which the command was run). Similarly, if a robot has a step set to create a file called C:\Temp\MyFile.txt and the robot is running on Linux, the file will be created, its name will be C:TempMyFile.txt and it will be saved in the Kapow installation folder under bin (this is the folder from where the RoboServer runs and requests the file creation).

If the robot runs on a Linux machine and has to create a file on a Windows machine, using \\MyServer\Files\MyFile.txt for the File Name will not work either (the robot will create a file called MyServerFilesMyFile.txt in the bin folder).

If a robot needs to create a file on a remote machine with a different OS (e.g. runs on Linux and needs to create files on Windows), it has to:

  1. create the file locally (E.g. /tmp/MyFile.txt or C:\Temp\MyFile.txt)
  2. copy the file from the machine on which it runs to the desired location on the remote machine

The attached robots are two examples on how to write a file on a remote Windows machine when the robot is running on Linux (samba-client needs to be installed on Linux) and how to write a file on a Linux machine when the robot is running on Windows (needs pscp on the Windows machine). Both robots were created in version 9.6.1.

Keywords: Kapow, write files, Kapow, Robotic Process Automation