Skip to content

File.LastWriteTime

property · File · cAlgo.API Since 5.7

DesktopCLICloud

Gets the time when the current file was last written to.

Environment behaviour

Cloud — not supported. Throws InvalidOperationException 'Getting file info is not supported in cloud environment.'

Definition

DateTime LastWriteTime {get;}
file.LastWriteTime: DateTime

Returns DateTime

Examples

protected override void OnStart()
{
    if (DataFile.LastWriteTime < DateTime.Now.AddDays(-1))
        Print("{0} has not been updated for more than a day", DataFile.Name);
}
from System import DateTime

if api.DataFile.LastWriteTime < DateTime.Now.AddDays(-1):
    api.Print(f"{api.DataFile.Name} has not been updated for more than a day")
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}