ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Stream file creation date

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stream file creation date

    I am writing a program to delete stream files 30 days after their creation. The wrklnk command displays the creation date, but the structure returned by stat() only has dates for modifications and access. Where can I get the file's creation date?

  • #2
    You can get the create date using the Qp0lGetAttr() API described here:


    However, I would think twice about this requirement. You want to delete a file that was CREATED 30 days ago... even if it was used 5 minutes ago? IMHO, most "delete old files" programs are based on the last time the file was USED -- or at least, the last time it was MODIFIED. To me it seems odd to base it on when it was created... who cares if it was created 50 years ago, as long as it's still be used and changed, right?

    Having said that... many (10?) years ago I wrote an article with a tool that deletes files based on create date. If that's useful to you, the article is here:
    Read through for news and resources on software development topics, including low-code-no-code, serverless computing and programming languages.


    Most likely (knowing the incompetence of iPro Developer) the code download won't work. But, if you need the code, drop me a message at http://www.scottklement.com/comment/ and I can e-mail it to you.

    Comment


    • #3
      Thank you Scott, for that insight.

      The files in question are sent to our vendors for various reasons and are rarely if ever accessed again, and it was this activity I was concentrating on. But that means the last access date and creation date are the same most of the time, so the access date would be the one I want.

      Any thoughts on why the creation date is not part of the stat() data structure?

      Comment


      • #4
        I would guess that the reason that stat() doesn't have the create date is simply because it was created to match the UNIX (POSIX) standard, which doesn't include the create date. Though, it does have other fields that aren't in the POSIX standard, so maybe I'm wrong about that? But, I don't know for certain, I can only guess....

        It does include the last access timestamp, so you should be good to go.

        Comment

        Working...
        X