UTOSdirectoryentry
Description
A UTOSdirectoryentry object represents a file or directory in a file system and gives access to some entry specific information. UTOSdirectoryentry objects should be considered to be a snapshot of a file or directory as it was at the time the object was created, since the objects are not updated when the file or directory information is changed.
Type Tags
None
Object Value
The value of a UTOSdirectoryentry object is the full specification of the file or directory it represents.
UTOSdirectoryentry.new()
Description
Creates a new UTOSdirectoryentry object for the specified file or directory.
Prototype
UTOSdirectoryentry
.new
(
string
,
integer name
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
name | None | string | Specifies the file or directory to create an object for. This may be either partially or fully specified, the interpretation of partially specified names being dependent on the operating system. |
error | .nul | integer |
Specifies an object which is used to output any error code generated during
creation of the UTOSdirectoryentry object. If
error is not specified or is
.nul then any error which occurs during object
creation will halt the program. If an error object is specified and
an error occurs during object creation then the error code is
output into that object and the new method
returns .nul .
|
Properties
Property | Type | Description |
---|---|---|
_ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. |
__ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. |
created | datetime |
Gives the date and time that the file or directory was created, according to
the information stored in the file system. This may be
.nul if the file system does not support this
information.
|
entrytype | string | Gives a description of the type of directory entry which the object represents. This will be either "file" or "directory". |
hidden | boolean |
Shows whether or not the file system considers the file or directory to be
'hidden'. If the file system does not support this, then the property
value will be .false .
|
lastaccessed | datetime |
Gives the date and time that the file or directory was last accessed according
to the information stored in the file system. This may be
.nul if the file system does not support this
information.
|
lastchanged | datetime |
Gives the date and time that the file or directory was most recently changed
according to the information stored in the file system. This may be
.nul if the file system does not support this
information.
|
name | string | Gives just the name of the file or directory, rather than the full specification of its location. |
readonly | boolean |
Shows whether or not the file system considers the file or directory to be
marked as available for read access. If the file system does not
support this, then the property value will be
.false .
|
size | integer |
If the UTOSdirectoryentry entry represents a file then this
property gives it size, otherwise it is .nul .
|
system | boolean |
Shows whether or not the file system considers the file or directory to be
reserved for system use. If the file system does not support this,
then the property value will be .false .
|
type | type | Specifies the UTOSdirectoryentry type object. |
Methods
copy()
Description
Copies a file to another location. An error is raised if this method is called for a UTOSdirectoryentry object which represents a directory. The UTOSdirectoryentry object itself is returned.
Prototype
UTOSdirectoryentryvar
.copy
(
string
,
boolean destination
,
integer replace
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
destination | None | string | Specifies the new location to copy the file to. Interpretation of this is operating system dependent, so it is safer to fully specify the destination file name. |
replace | .false | boolean |
Specifies whether or not to replace any existing file. If this is given as
.false or is omitted and there is already a
file at the specified destination then an error will be raised,
which may be operating system dependent.
|
error | .nul | integer |
Specifies an object which is used to output any error code generated during
the copying of the file. If error is not
specified or is .nul then any error which
occurs during copying will halt the program. If an error object
is specified and an error occurs during copying then the error
code is output into that object and the copy
method returns .nul .
|
getdirectory()
Description
Creates a new UTOSdirectory object for the directory which
contains the file or directory represented by the object for which
this method is called. If there is no such directory then no error is
raised but .nul
is returned.
Prototype
UTOSdirectoryentryvar
.getdirectory
(
integer
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
error | .nul | integer |
Specifies an object which is used to output any error code generated during
creation of the UTOSdirectory object. If
error is not specified or is
.nul then any error which occurs during object
creation will halt the program. If an error object is specified
and an error occurs during object creation then the error code is
output into that object and the getdirectory
method returns .nul .
|
move()
Description
Moves a file or directory to another location. It is not always possible to move a file or directory to another volume, partition or device, so the error parameter should normally be used. The UTOSdirectoryentry object itself is returned.
Prototype
UTOSdirectoryentryvar
.move
(
string
,
boolean destination
,
integer replace
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
destination | None | string | Specifies the new location to move the file or directory to. Interpretation of this is operating system dependent, so it is safer to fully specify the destination file or directory name. |
replace | .false | boolean |
Specifies whether or not to replace any existing file or directory. If this is
given as .false or is omitted and there is
already a file or directory at the specified destination then an
error will be raised, which may be operating system dependent.
The behaviour when an attempt is made to replace a directory may
be operating system dependent.
|
error | .nul | integer |
Specifies an object which is used to output any error code generated during
the moving of the file or directory. If error
is not specified or is .nul then any error
which occurs during moving will halt the program. If an error
object is specified and an error occurs during moving then the
error code is output into that object and the
move method returns .nul .
|
rename()
Description
Changes the name of the file or directory represented by the UTOSdirectoryentry object for which the method is called. The UTOSdirectoryentry object itself is returned.
Prototype
UTOSdirectoryentryvar
.rename
(
string
,
integer newname
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
newname | None | string | Specifies the new name of the file or directory. This is just the name, and must not contain any path component. |
error | .nul | integer |
Specifies an object which is used to output any error code generated during
the renaming of the file or directory. If
error is not specified or is
.nul then any error which occurs during
renaming will halt the program. If an error object is specified
and an error occurs during renaming then the error code is output
into that object and the rename method returns
.nul .
|
setattributes()
Description
Sets the values for the 'attributes' of a file or directory. The UTOSdirectoryentry object itself is returned.
Prototype
UTOSdirectoryentryvar
.setattributes
(
boolean
,
boolean readonly
,
boolean hidden
,
integer system
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
readonly | The current value of the readonly property | boolean |
Specifies the required value of the readonly property for
the file or directory.
|
hidden | The current value of the hidden property | boolean |
Specifies the required value of the hidden property for the
file or directory.
|
system | The current value of the system property | boolean |
Specifies the required value of the system property for the
file or directory.
|
error | .nul | integer |
Specifies an object which is used to output any error code generated during
setting of the attributes of the file or directory. If
error is not specified or is
.nul then any error which occurs during the
attribute setting will halt the program. If an error object is
specified and an error occurs during attribute setting then the
error code is output into that object and the
setattributes method returns
.nul .
|
setdates()
Description
Sets the values for the dates of a file or directory. The UTOSdirectoryentry object itself is returned.
Prototype
UTOSdirectoryentryvar
.setdates
(
integer
,
integer created
,
integer lastchanged
,
integer lastaccessed
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
created | The current value of the created property | integer |
Specifies the required value of the created property for
the file or directory. The actual value set may be different from
this value, for example if the file system stores dates and times
to a lower degree of precision than those used in SIMPOL. This
parameter should not be specified if the file system does not
support file creation times.
|
lastchanged | The current value of the lastchanged property | integer |
Specifies the required value of the lastchanged property
for the file or directory. The actual value set may be different
from this value, for example if the file system stores dates and
times to a lower degree of precision than those used in SIMPOL.
This parameter should not be specified if the file system does
not support file changed times.
|
lastaccessed | The current value of the lastaccessed property
| integer |
Specifies the required value of the lastaccessed property
for the file or directory. The actual value set may be different
from this value, for example if the file system stores dates and
times to a lower degree of precision than those used in SIMPOL.
This parameter should not be specified if the file system does
not support file access times.
|
error | .nul | integer |
Specifies an object which is used to output any error code generated during
setting of the dates of the file or directory. If
error is not specified or is
.nul then any error which occurs during the
date setting will halt the program. If an error object is
specified and an error occurs during date setting then the error
code is output into that object and the
setdates method returns
.nul .
|