11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DIR<br />

Syntax<br />

DIR(file.expr)<br />

Description<br />

The <strong>UniBasic</strong> DIR function returns the file size (in bytes), the last date and time the<br />

file was modified (in internal format), and the privileges for the file. UniData stores<br />

these values in the first four attributes of the return value. file.expr must evaluate to<br />

a file name at the operating system level. If you do not specify a path, UniData<br />

searches the current directory.<br />

Example<br />

The following UNIX program segment retrieves the file statistics on the UniData file<br />

stored in the subdirectory /usr/accounting/gl. The first attribute contains the file size<br />

in bytes, the second attribute contains the date the file was last updated, and the third<br />

attribute contains the time the file was last updated. UniData stores the second and<br />

third attributes in internal format, and the example converts them to the external<br />

format.<br />

1-215 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

FILESTAT = DIR("/usr/accounting/gl")<br />

SIZE = FILESTAT <br />

DATE.MOD = OCONV(FILESTAT,'D2/')<br />

TIME.MOD = OCONV(FILESTAT,'MT')<br />

PRINT 'The gl file is ':SIZE<br />

PRINT 'And was last modified: ':DATE.MOD,TIME.MOD

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!