Basic Administration > Supporting Collaboration > Workflow Administration > Workflow Tools > Workflow Template Administration > Workflow Code Samples > Synchronize Robot Samples > Synchronize on Existence of a File
  
Synchronize on Existence of a File
This topic provides a sample of the Synchronize robot node recognizing the existence of a specified file.
Referenced Workflow
SynchronizingOnExistenceOfFile.xml
Description
The expression in the robot keeps running until the specified file exists. It sets the result to EXISTS if the file exists. In the workflow template, there is a Notification robot node, which sends email to responsible roles if the synchronization has been aborted.
Instructions
myFilePath and myFileName are variables defined in the workflow template. myFilePath must be similar to c://temp.
Copy the following code:
//Check if the given file exists in the path specified. If so, set result to "EXISTS" else keep checking
java.io.File myFile = new java.io.File(myFilePath , myFileName );
if ( myFile.exists( )){
result= "EXISTS";
}
else
result=null