File_Utilities module

file_modtime

procedureSource

When the file was last written, and whether it exists; the same as file_modtime_and_size without the size.

file_modtime :: (file_path: string) -> (modtime: Apollo_Time, file_exists: bool)

Parameters

file_path: string

Returns

modtime: Apollo_Time
file_exists: bool
Example↗
#import "Extensions/Environment";
#import "File";
base := environment_variable("TMPDIR");
if base == "" base = environment_variable("TEMP");
if base == "" base = "/tmp";
path := tprint("%/jai-doc-file-modtime.txt", base);
defer file_delete(path);
assert(write_entire_file(path, "x"));
time, found := file_modtime(path);
assert(found && compare_apollo_times(time, APOLLO_TIME_INVALID) != 0);

See also