FileExists
Mon 01 January 2018Syntax
FileExists(filename [, pathtype])
Description
Use the FileExists function to determine whether a particular file or directory is present on your PeopleSoft system, so, in the case of a file, you can decide which mode to use when you open the file for writing or whether the file is available to be read, and, in the case of a directory, you can decide whether the directory already exists or needs to be created.
Note: If you want to open a file for reading, you should use the "E" mode with the GetFile function or the File class Open method, which prevents another process from deleting or renaming the file between the time you tested for the file and when you open it.
Important! The FileExists function can be used to confirm the existence of a directory on a Windows shareâfor example, \\my_server\temp\mydir. However, if the root of a Windows share (for example, \\my_server\temp) is passed to FileExists, the return value will always be False.
Parameters
Field or Control |
Definition |
---|---|
filespec |
Specify the name, and optionally, the path, of the file or directory you want to test. |
pathtype |
If you have prepended a path to the file name, use this parameter to specify whether the path is an absolute or relative path. The valid values for this parameter are:
If you donât specify pathtype the default is %FilePath_Relative. If you specify a relative path, that path is appended to the path constructed from a system-chosen environment variable. A complete discussion of relative paths and environment variables is provided in documentation on the File class. See . If the path is an absolute path, whatever path you specify is used verbatim. You must specify a drive letter and the complete path. You canât use any wildcards when specifying a path. The Component Processor automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a Windows system, UNIX "/" separators are converted to "\", and on a UNIX system, Windows "\" separators are converted to "/". Note: The syntax of the file path does not depend on the file system of the platform where the file is actually stored; it depends only on the platform where your PeopleCode is executing. |
Returns
A Boolean value: True if the file or directory exists, False if it doesnât.