create date

  • 30 Dec

    Q&A 38: I would like to log the create date of the file being moved

    Q: I would like to log the create date of the file being moved. Can you please advise if there is a way filemover can be setup to log the create date of the file being moved. As of now we don’t see this info in the log file. Is there a setting in the app that we can tweak to control what all is logged in the log file?
    A: We added some extra Pascal Script functions in version v2020.12.30.0 to achieve this.

    Please open the Pascal Script option of your Rule:

    Limagito File Mover Pascal Script option

    Enable and Add the following ‘On Destination’ Pascal Script:

    Var
      tmpDateTime: TDateTime;
      tmpDateStr: String;
    Begin
      psExitCode:= 1;
     
      // Creation Time
      tmpDateTime := psGetCreationTime(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Creation Time of ' + psFilePath + psFileName + ': ' + tmpDateStr);
     
      // Creation Time Utc
      tmpDateTime := psGetCreationTimeUtc(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Creation Time Utc of ' + psFilePath + psFileName + ': ' + tmpDateStr);
     
      // Last Access Time
      tmpDateTime := psGetLastAccessTime(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Last Access Time of ' + psFilePath + psFileName + ': ' + tmpDateStr);
     
      // Last Access Time Utc
      tmpDateTime := psGetLastAccessTimeUtc(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Last Access Utc Time of ' + psFilePath + psFileName + ': ' + tmpDateStr);
     
      // Last Write Time
      tmpDateTime := psGetLastWriteTime(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Last Write Time of ' + psFilePath + psFileName + ': ' + tmpDateStr);
     
      // Last Write Time Utc
      tmpDateTime := psGetLastWriteTimeUtc(psFilePath + psFileName);
      tmpDateStr := FormatDateTime('YYYY-MM-DD HH:NN:SS', tmpDateTime);
      psLogWrite(1, '', 'Last Write Utc Time of ' + psFilePath + psFileName + ': ' + tmpDateStr);
    End.

    Limagito File Mover Pascal Script Get Creation Time

    RunTime Log Result:

    Limagito File Mover RunTime log

    In the example we added ‘Creation Time (Utc)’, ‘Last Access Time (Utc)’ and ‘Last Write Time (Utc)’. You can, of course, remove the parts you do not need from the Pascal Script.

    If you need any help with this ‘log the create date’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Pascal Script Q&A
SEARCH