SIMPOL Documentation

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 name, integer error )

Parameters

ParameterDefault valueType nameDescription
nameNonestring 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.nulinteger 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

PropertyTypeDescription
_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.
createddatetime 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.
entrytypestring Gives a description of the type of directory entry which the object represents. This will be either "file" or "directory".
hiddenboolean 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.
lastaccesseddatetime 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.
lastchangeddatetime 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.
namestring Gives just the name of the file or directory, rather than the full specification of its location.
readonlyboolean 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.
sizeinteger If the UTOSdirectoryentry entry represents a file then this property gives it size, otherwise it is .nul.
systemboolean 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.
typetype 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 destination, boolean replace, integer error )

Parameters
ParameterDefault valueType nameDescription
destinationNonestring 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.falseboolean 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.nulinteger 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
ParameterDefault valueType nameDescription
error.nulinteger 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 destination, boolean replace, integer error )

Parameters
ParameterDefault valueType nameDescription
destinationNonestring 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.falseboolean 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.nulinteger 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 newname, integer error )

Parameters
ParameterDefault valueType nameDescription
newnameNonestring Specifies the new name of the file or directory. This is just the name, and must not contain any path component.
error.nulinteger 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 readonly, boolean hidden, boolean system, integer error )

Parameters
ParameterDefault valueType nameDescription
readonlyThe current value of the readonly propertyboolean Specifies the required value of the readonly property for the file or directory.
hiddenThe current value of the hidden propertyboolean Specifies the required value of the hidden property for the file or directory.
systemThe current value of the system propertyboolean Specifies the required value of the system property for the file or directory.
error.nulinteger 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 created, integer lastchanged, integer lastaccessed, integer error )

Parameters
ParameterDefault valueType nameDescription
createdThe current value of the created propertyinteger 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.
lastchangedThe current value of the lastchanged propertyinteger 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.nulinteger 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.