vfsDescribeFile

function

Library: File system utilities (OMVFS legacy)
Include: omvfs.xin

Declaration
define external function vfsDescribeFile
       value       vfsFile  file
 into  modifiable  stream   attributes

Argument definitions

file
is the vfsFile object to query.
attributes
is the returned shelf of description items.


Purpose

Use vfsDescribeFile to return a set of attributes describing a file.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omvfs.xin"

file must be open (else external exception VFS200).

Usage Notes

The attributes shelf returned by this function contains the following keyed items.

  1. "name" (fully qualified file or directory name)
  2. "size" (file size in bytes)
  3. "atime"" (last accessed time in OmniMark date format)
  4. "mtime" (last modified time in OmniMark date format)
  5. "ctime" (last status change time in OmniMark date format)
  6. "permissions" (integer representation of file permissions)
  7. "owner" (username of owner)
  8. "group" (group of file)

If a particular attribute item is not supported by a virtual file system, it is returned as an empty string.

If the device on which the file is located is a read-only device (such as a CD-ROM), the atime value may be zero.

The attributes shelf is initially cleared of all contents.

External exception VFS300 is thrown for any general OS operation failure. The text accompanying the exception will contain details on the reason for the failure.

Example

Obtaining the size of a file in a subdirectory of the current directory.

  include "omvfs.xin"
  
  process
      local stream file-attrs variable
      local vfsFile myfile
  
      set myfile to vfsOpen "programs/myscript.xom"
      vfsDescribeFile myfile into file-attrs
      output file-attrs {"size"} || "%n"