File system metadata - Factor Documentation (original) (raw)

These are words for querying the metadata of filesystems and filesystem objects. file-info and link-info can be used to get detailed information on a file in the manner of stat(2) or lstat(2). Type predicates like directory? can be used on both file-info-tuples returned by file-info et al, and on paths. In the former case only the tuple itself is inspected; in the latter, the filesystem is queried and links are dereferenced. Note that in the case of symlinks, both symbolic-link?, and the predicate matching the object the link points to, will return true.

File metadata:

file-info-tuple

file-info ( path -- info )
link-info ( path -- info )
file-exists? ( path -- ? )

File types:
File types

directory? ( path/info -- ? )

regular-file? ( path/info -- ? )
symbolic-link? ( path/info -- ? )

File permissions:

file-readable? ( path -- ? )

file-writable? ( path -- ? )
file-executable? ( path -- ? )

File system metadata:

file-system-info ( path -- file-system-info )

file-systems ( -- array )