System Class
Username:  
Password:
  > Home
> User Guide
v Reference
    > Introduction
    > CROFT
    v BEE Variables
       v BEE Variable Name
          o General/Object Class
          o Special Class
          o System Class
       o BEE Variable Value
       > BEE Conversions
    > BEE Syntax
    > BEE Commands
    > Database Operation
    > Content Management
    > Objects and Classes
    > Interface with others
    o Glossary
> Portal Object
> Development Guide


Shortcuts
sys Class
debug Class
Intrinsic Conversions
>> Reference >> BEE Variables >> BEE Variable Name >> System Class <=  =>      <  1  2  3  4  5  6  7  8  9  10  11  12  >  
file System Class

n        file is contains information about files in your directory.  The "name" part of a file class variable is taken as the name of a file under the FileDir – {sys%croft:filedir}.  You may specify files under the CROFT directories (those specified in {sys%croft:wwwdir}, {sys%croft:textdir}, {sys%croft:schemedir} and {sys%croft:vbdir}), but in this case you need to specify them in full path (e.g. file%{sys%croft:wwwdir}/images/logo.gif&size}).

Variable

Value/meaning

Access

file%file&name
file%file&basename
file%file&dirname
file%file&size
file%file&mimetype
file%file&atime
file%file&ctime
file%file&mtime
file%file&exists
file%file&readable
file%file&writable
file%file&isdir
file%file&isfile
file%file&content
file%file&contents

The name of the file
The file name without directory path
The directory name of the file
The file size in bytes
The MIME content type of the file
The last access time of the file
The last inode change time of the file
The last modification time of the file
1 if the file exists, or 0 if otherwise
1 if the file is readable, or 0 if otherwise
1 if the file is writable, or 0 if otherwise
1 if file is a directory, or 0 if otherwise
1 if file is a file, or 0 if otherwise
The content of the file in a string
Same as file%file&content

get

file%file&text
or
file%file

The array that holds all the text lines in the file, indexed numerically starting from 0 (the first line is file%file&text:0 or file%file:0).

If file is a directory, the array contains a list of file names in that directory in "natural" orders returned from the operating system.

The text lines are held in cache.  Once accessed, it will be available even if the file is renamed or even deleted.

get

file%file&action:copy

Copy the file named by the variable to the file named by the set value
(file%fromfile&action:copy = "{tofile}"; The {tofile} is in FileDir – {sys%croft:filedir}, or {sys%croft:wwwdir} or {sys%croft:textdir} provided the full path is specified.)

set

file%file&action:delete

Delete the file unless the value is set to zero or blank

set

file%file&action:existence

Delete the file if the value is set to zero or blank.

Note: file%file&action:existence is the opposite of file%file&action:delete.

set

file%file&action:rename
file%file&action:name

Rename the file to the new name in the set value
(file%oldname&action:rename = "{newname}"; The {newname} is in FileDir – {sys%croft:filedir}, or {sys%croft:wwwdir} or {sys%croft:textdir} provided the full path is specified.)

set

file%file&action:source

Copy the file named by the set value to the file named by the variable
(file%tofile&property:source = "{fromfile}";)

Note: file%file&action:source is the same as file%file&action:copy, except that the direction of the copying is reversed.  The set value of the former is the "fromfile", while that of the later is the "tofile".  (The {tofile} is in FileDir – {sys%croft:filedir}, or {sys%croft:wwwdir} or {sys%croft:textdir} provided the full path is specified.)

set

file%file&action:write

Write the lines in file%file&text up to the number of characters specified in the set value (0 or non-numeric for all).

Note: file%file&text is held in cache.  Nothing will be written to the actual file while the variable is being built up, until the write action.

set

 

Note: Accessing file%file&text multiple times (e.g. in a loop) does NOT incur overhead of file opening, seeking and closing.  The whole file is loaded into the variable upon the first access of file%file%text.  Subsequent accesses are directly from the variable itself.  (PHP underlying the BEE system handles variable memory in a neat and efficient way.)

 

Previous Page       Next Page

Accsoft Computer Technology Pty Ltd     ABN: 98 065 617 549
PO Box 892, Epping NSW 1710         Level 1, Epping Office Park, 242 Beecroft Rd, Epping NSW 2121, Australia
Tel: Sydney - (02)98691668     National - 1300-881668         Fax: (02)98691866
© Copyright 2003 Accsoft Computer Technology Pty Ltd