Search

May 30, 2025

FolderExists

 

In document automation, there are times when your template needs to check whether a particular folder exists. This can be useful when:

  • Saving generated documents into specific client folders.
  • Checking for the presence of required directories before proceeding.
  • Saving to external file systems (such as NetDocuments/iManage).

XpressDox provides the FolderExists function for exactly this purpose.

 

 

What is FolderExists?

The FolderExists function checks whether a specified folder exists in the file system. It works similarly to the FileExists function, but instead of checking for a file, it checks for a folder.

 

Syntax

FolderExists(FolderPath)
  • FolderPath is the full path (or relative path) to the folder you want to test.
  • The function returns True if the folder exists, or False if it does not.

 

Example 1

«If(FolderExists('C:\ClientFiles\Smith\Documents'))»
The client folder exists.
«Else»
The client folder does not exist. Please create the folder before proceeding.
«End()»

Example 2

You can also combine it with user input or calculated folder paths:

«SetVr('ClientFolder,concat('C:\ClientFiles\',ClientName))»

«If(FolderExists(GetV('ClientFolder'))»
The folder for «ClientName» exists.
«Else»
The folder for «ClientName» does not exist.
«End()»