File Exists

This activity helps to find out if a file exists in a directory or not.

Technical Reference

 

INPUT

FilePath: Indicate the path of the file for which you want to check the existence status.

Specify the file name along with the directory name here. The directory name should be within the server.

You have the option to either hardcode the values in the "String” variable or pass the values as “String” datatype.

This accepts only the “String” datatype.

 

 

 

 

 

 

 

MISC

Display Name: Displays the name of the activity. The activity name can be customized which will help in troubleshooting.

SkipOnError: Specify the Boolean value as “True or False.”
True: Continues to execute the workflow irrespective of any error thrown.
False: Stops the workflow if it throws any error.
None: If the option is specified as blank, by default the activity will perform the “False” action.

Version: It specifies the version of the FTP automation feature in use

 

OUTPUT

FileExist: Declare a variable here, which will show the exist status of the file. The result is seen only in “Boolean” datatype.

Result: It helps to view the execution state of the activity. It returns the values in Boolean format.
True: It indicates that the activity has been executed successfully without any error.
False: It indicates that the activity has been unsuccessful due to some unexceptional error thrown.

*Represents mandatory fields to execute the workflow.

Let’s see how this activity works.

1.      Create a new solution or open an existing solution.

2.      Drag and drop a “FTP” activity which will act as a scope for all the activities
within this feature.

a.      Double click on the activity.

b.      Enter the server name, username and password.

3.      Drag and drop the “File exists” activity within the workflow.

a.      Double click on the activity.

b.      Enter the file name with the path for which the exist status has to
be found. Here I am going to find if the file “Patient History” exists or
not. Here we must enter the directory name along with the file name
in the file path.

c.      The path of the file can be entered directly in the Filepath box by
 navigating to the property section.

d.      There are two ways to create a variable.

i.Method 1 – Click on the “FileExist” property within the
                “FileExists” activity and enter the variable name. In this case,
                I have used the name "FE." Then, press "Ctrl+Q," which is a
                shortcut key to create a variable.

ii. Method 2 - Click on the Variable pane and enter the name "FE."
         Then, click on the "DataTypes" column and select "Boolean." 

e.      To see the output, use a writeline or writelog activity. Mention the variable
given in the result box along with “.ToString” extension as the result is stored
in “Boolean” datatype.

i. For example, here, we can use the syntax “FE.ToString” in the writeline
box to see the file exist status.

Click here to see how the activity works in a workflow.