title: how to compress log files older than 30 days in windows?
body: <p>I write below powershell script to compress logs older than 30 days:-</p>
  
  <pre><code>$LastWrite=(get-date).AddDays(-30).ToString("MM/dd/yyyy")
  
  Get-ChildItem -Filter "server.log*" -Recurse -File | Where-Object 
  {$_.LastWriteTime -le $LastWrite} 
  </code></pre>
  
  <p>Now, I am unable to get compressed command in powershell via which I can compress(zip/tar) the server.log* files older than 30 days. 
  Expecting a single command which i can use by adding a pipe sign in the above command.</p>