File.info

From MiniScript Wiki
Revision as of 21:09, 5 January 2021 by JoeStrout (talk | contribs) (Created page with "The <c>file.info</c> method returns a map of details about an existing file or directory at the given path. === Arguments === {| class="wikitable" |- ! Parameter Nam...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The file.info method returns a map of details about an existing file or directory at the given path.

Arguments

Parameter Name Default Value Meaning
path "" file name, partial path, or absolute path to file of interest

If given a file name or partial path, it will be interpreted relative to the current working directory (see file.curdir).

Result

If the specified file exists, file.info returns a map with the following entries:

Key Example Value Meaning
"path" "/usr/data/test.txt" full path to the file/directory
"isDirectory" 0 1 if a directory, 0 if an ordinary file
"size" 13 size of the file, in bytes (0 for directories)
"date" "2021-01-05 13:52:56" creation or last modification date of the file, in SQL date/time format
"comment" "" comment associated with the file, if any

If the file does not exist, then file.info returns null.