Use the external file object to work with files in
the Expression Engine Language (EEL). Read and Write operations are
supported in the file object and there are additional functions for
manipulating and working with files.
The file object can
be used to open, read, and write files. A file is opened using the
file object. For example:
File f
f.open("c:\filename.txt","r")
In this example, the
OPEN() function opens filename.txt. The mode for opening the file
is read. Other modes are "a" (append to end of file) and
"w" (write). A combination of these switches can be used.
Executing Programs and File Commands
To execute programs,
use the EXECUTE() function:
execute(string)
For example, the following
code changes the default permissions of a text file created by the
Data Job Editor.
To execute the command
in Microsoft Windows, enter:
execute("/bin/chmod", "777", "file.txt")
Or, to execute from
the UNIX shell, enter:
execute("/bin/sh", "-c", "chmod 777 file.txt")
Running a Batch File By Using Execute Function
To invoke the MS-DOS
command prompt, call the cmd.exe file. For example: