Obtain file creation date

Hi!

Does anybody know how can I get the creation date of a file? I know that is possible to know the last written date and time, but I want the creation date.

Thanks!

Comments

  • You can try to use "'Microsoft Scripting Runtime'.File" automation and the property DateCreated.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Thanks, Kine!! It's exactly what I was looking for. But I don't know how to use those variables. I mean, which is exactly the code to open a textfile? I suppose It's necessary to use another "'Microsoft Scriptime Runtime'.FileSystemObject" variable, but I don't know how.

    Thank you very much in advance.
  • Something like this:
      FileAut := FyleSystemObject.GetFile(FileName);
      MESSAGE('%1',FileAut.DateCreated);
    

    But when I tried, I had problem that it could not find any file with path. It took only file name (without path part) and was searching for this file in Client folder.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Hi BamVer.

    You got to get the folder object before you can get the file object as Kine wrote.

    Best Regards
    It is impossible to make anything foolproof, because fools are so ingenious.
  • Got it!!

    The code I use:

    CREATE(FileSystemObject);
    File := FileSystemObject.GetFile(CurrDataport.FILENAME);
    MESSAGE(FORMAT(File.DateCreated));

    Thank you very much, Kine and Soft Tod!