Please enable JavaScript to view this site.

ESL Documentation

FILEIO Subroutine

Create a new directory.

 

call CreateDirectory(DirectoryPath_SV)

Parameters

DirectoryPath_SV

A string containing the path of the directory that will be created. Only the final directory in the path will be created.

Description

This routine creates a directory, provided the path to that directory currently exists. The example below, demonstrate how to build a complete path.

Errors

FIO_E_DIRECTORYEXISTS

The directory already exists.

FIO_E_INVALIDPATH

The specified path does not exist.

FIO_E_NAMEERROR

The name of the directory to be create is not valid.

Example

The following example of a recursive ESL subroutine shows how the CreateDirectory can be used to create a complete path:

#====================================================================

subroutine BuildDirectoryPath(string: Directory_SV, boolean: OK_BV) is

#====================================================================

 

string  Path_LSV

        Message_LSV

 

integer ErrorLevel_LIV

 

   extract from ReverseStringFunction(Directory_SV)

      skip by "\\"

      take to last Path_LSV

   call ReverseString(Path_LSV)

   if (length of Path_LSV > 3) then

      call IsDirectory(Path_LSV, OK_BV)

      if not OK_BV then

         call BuildDirectoryPath(Path_LSV, OK_BV)

      end if

      if OK_BV then

         call CreateDirectory(Directory_SV)

         if (errorlevel != FIO_E_ERRORFREE) then

            copy errorlevel to ErrorLevel_LIV

            call GetError(ErrorLevel_LIV, Message_LSV)

            send "Unable to create " Directory_SV " because " Message_LSV "\n" to errorlog

            copy false to OK_BV

         end if

      end if

   else

      copy false to OK_BV

   end if

See Also

IsDirectory( ) subroutine.

ListDirectory( ) subroutine.

RemoveDirectory( ) subroutine.