Author Topic: Command that Resets Files in Custom Logs Every Month  (Read 1191 times)

0 Members and 1 Guest are viewing this topic.

ThatGirlSlays

  • Youngling
  • *
  • Posts: 42
  • Karma: +0/-0
    • View Profile
    • Instagram
  • Twitch Name: ThatGirlSlays
Command that Resets Files in Custom Logs Every Month
« on: May 10, 2017, 11:14:30 PM »
Hello,

I'm trying to build a command that will track user actions over the span of a month, updating text files in a given folder up until a new month starts and then the files will be purged on or after the first of the following month. I'm not sure how to do a conditional statement on a date or set a date as the 1st day of the following month. For instance, I was thinking I would have a file called Date.txt and the first time the command runs (when a user first performs a task), the file would be updated with the value of the first day of the following month. So if today is 2017-05-10, and someone initiates a task it would start tracking activity and the line 2017-06-01 (or other date format) would be written to the file Date.txt. And then every other time a task is done, the file Date.txt will be checked and if the current local date is greater than the value in the file then the files will be purged. Otherwise, the files will be kept until the date passes.

Does that make sense?