Announcement

Collapse
No announcement yet.

automatically delete old log files

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

  • automatically delete old log files

    Hi there,

    My formulas generate log files... is there any way to automatically delete log files that are older than three days from within PostMain or otherwise automatically do so at system shutdown?

    Filename convention: "(yyyy-mm-dd) filename.txt"
    All log files are stored in the FormulaOutputRoot directory.

    Been looking through the file I/O section and can't seem to find any applicable commands.

    Thanks in advance...

    Regards,
    Ryan.

  • #2
    Re: automatically delete old log files

    Hi Ryan,

    There is no way to delete the files, if you are after a solution to minimize the file size, you could open them using the wt flag, e.g.
    PHP Code:
    yourFileObject.open("wt+");//opens and overwrites previous file 
    then you would close the file.

    Hope this helps.

    Originally posted by rdehavelyn
    Hi there,

    My formulas generate log files... is there any way to automatically delete log files that are older than three days from within PostMain or otherwise automatically do so at system shutdown?

    Filename convention: "(yyyy-mm-dd) filename.txt"
    All log files are stored in the FormulaOutputRoot directory.

    Been looking through the file I/O section and can't seem to find any applicable commands.

    Thanks in advance...

    Regards,
    Ryan.

    Comment


    • #3
      Thanks for the suggestion Steve.

      The issue is that each advanced chart I look at generates a unique log file for each interval viewed per single security. You can imagine that the number of files generated quickly multiplies...

      I suppose I could try changing the naming convention and generate a single log file for all trades taken on any single day of the week... then I could use your suggested code to overwrite the file for the same day the following week and therefore only have 5 files going at any one time.

      The issue of course will be that the files will become quite large but this is certainly a huge improvement over the current situation... thanks again!

      Regards,
      Ryan.

      Comment

      Working...
      X