Top
Top
LibraryEASYProcess Reference ManualProcessesServicesFileSystemWorkshopDirectoryExists

DirectoryExists Overview

DirectoryExists service checks whether a certain directory exists. The service will look for the path on application server, unless you specify the target server name or IP address in the directory path.

This can be helpful when you need to dynamically create a directory based on the user or entity the files you wish to save are associated with. For example, saving images or message attachments that are stored in a directory that correspond to the particular message/userid it belongs to. You will first need to check if the directory exist and if not, create it.


DirectoryExists Use Examples
Workshop:FileSystemWorkshop
Service:DirectoryExists
Inputs
DirectoryNameThe full path of the directory to be checked. You can also give a network path or a mapped folder path.

Outputs
ExistsReturns True/False depending on whether the directory exists

DirectoryExists Use Example

Basic DirectoryExists Use

This is an example that if the directory doesn’t exists, then create the directory. Otherwise, do the rest in the process flow.

Using DirectoryExists for Message Attachments

In this example, we examine a feature called the message center. Users with access (like an admin) have the ability to save messages and provide attachments. Then, certain users receive a notification that a new message exist and can be viewed. Upon viewing the message, the attachment is available to all users viewing the new message.

This is done by dynamically checking if a directory already exists and if not, creating a directory based on the MessageId. Each time a message is created, it is first assigned a MessageId. Then, in order to add an attachment, the process puts together the file paths for the “Attachments” parent folder, the “MessageCenter” folder within that, and the “[MessageId]” folder within that (this one may not exist yet if the message is new). This is done in the “Paths” evaluate.

From there it checks if the directory for the MessageId exists with the DirectoryExists service. As mentioned, if the message is new, it won’t exist yet. This is where CreateDirectory is used, for new messages. After finding the MessageId folder exists or creating it, the attachment is saved to that folder.

Here is the DirectoryExists configuration


Powered by EASYProcess (© 2019 K-Rise Systems, Inc).