file_property/2

"file_property(+ File,? Property" )

The atom File corresponds to an existing file, and Property will be unified with a property of this file. The properties are of the form

  • type( _Type_) gives whether the file is a regular file, a directory, a fifo file, or of unknown type;

  • size( _Size_) gives the size for a file;

  • mod_time( _Time_) gives the last time a file was modified according to somae Operating System dependent timestamp;

  • mode( _mode_) gives the permission flags for the file

  • linkto( _FileName_), gives the file pointed to by a symbolic link.

Properties can be enumerated through backtracking:


 ?- file_property('Makefile',P).
 P = type(regular) ? ;
 P = size(2375) ? ;
 P = mod_time(990826911) ? ;
 no