title: NLog - delete logs older than X days
body: <p>How I can delete files with logs older than X days. It's simple, but I have in one folder logs only from one day. My NLog.config looks like: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true"&gt;
    &lt;extensions&gt;
      &lt;add assembly="NLog.Extended" /&gt;
    &lt;/extensions&gt;
    &lt;variable name="LogHome" value="PATH"/&gt;
    &lt;variable name="DailyDir" value="${LogHome}${date:format=yyyy}/${date:format=MM}/${date:format=dd}/"/&gt;
    &lt;targets&gt;
      &lt;target name="asyncFile" xsi:type="AsyncWrapper"&gt;
        &lt;target
          name="fatalLog"
          xsi:type="File"
          layout="${longdate}|${callsite}|${message}|${exception}"
          fileName="${DailyDir}/Fatal.txt"
                /&gt;
      &lt;/target&gt;
      &lt;target name="asyncFile" xsi:type="AsyncWrapper"&gt;
        &lt;target
          name="errorLog"
          xsi:type="File"
          layout="${longdate}|${callsite}|${message}|${exception}"
          fileName="${DailyDir}/Error.txt"
                /&gt;
      &lt;/target&gt;
    &lt;/targets&gt;
    &lt;rules&gt;
      &lt;logger name="*" level="Fatal" writeTo="fatalLog" /&gt;
      &lt;logger name="*" level="Error" writeTo="errorLog" /&gt;
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>