Skip to main content
InSource KnowledgeCenter

TN AppSvr197 How to verify if a file exists using Application Server scripting

Description

 

This article from InSource shows how to verify if a file exists using Application Server scripting

  • Author: Benjamin Davis
  • Published: 04/28/2016
  • Applies to: Application Server

Details

Use the .NET System.IO.File.Exists method to verify if a file exist using Application Server scripting.

For example,

If System.IO.File.Exists("C:\Stuff\HelloWorld.txt") Then
    Me.xxx = True;
Else
    Me.xxx = False;
EndIf;

The script will look in the Stuff folder located on the C drive for a file called HelloWorld.txt.

If the file exist, it will change the attribute xxx to 1. If it does not exist, it will change attribute 

to 0.