# 22. Virtuoso Functions Guide - file_stat

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
file_delete
file_dirlist
file_mkdir
file_mkpath
file_stat
file_to_string
file_to_string_outpu...
file_unlink
os_chmod
os_chown
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## file_stat

get various OS statistics about a file
file_stat (in path varchar, in what integer);
Parameters
path – varchar relative path.
what – integer info to be returned.

- 0 - (default) file modification time (st_mtime)
- 1 - file size (st_size, bytes)
- 2 - file mode (st_mode, as integer)
- 3 - file modification time for directories only (st_mtime)
- 4 - file owner (user name corresponding to st_uid)
- 5 - file group (group name corresponding to st_gid)

Description

file_stat returns various information for an OS file by calling stat () system call and converting the relevant value to a varchar. The path is relative to the server's working directory. The what is an integer value selecting what information to return. If you don't supply second argument to the function it defaults to mode = 0.

The DirsAllowed and DirsDenied lists in Parameters section of the virtuoso configuration file (virtuoso.ini by default) are not used to control disk access.

Examples
Simple example

Get the size of the virtuoso INI file

    SQL>select file_stat (virtuoso_ini_path(), 1);
    callret
    VARCHAR
    _______________________________________________________________________________

    958

See Also

file_delete

os_chmod

os_chown

virtuoso_ini_path