title: PowerShell multiple statement conditions - compare dates in filenames
body: <p>What I am trying to do is any file name with &quot;D&quot; value that is 4 days or older than &quot;t&quot; value - do something.
  For example:
  (t = today's day)(d = is typically the same as t, but occasionally it is 4 days or more older)</p>
  <p>c:\temp\test_d210115_t210115.txt - won't do anything</p>
  <p>c:\temp\test_d210112_t210115.txt - won't do anything</p>
  <p>c:\temp\test_d210108_t210115.txt - do something</p>
  <p>c:\temp\test_d210111_t210115.txt - do something</p>
  <pre><code>$DATA_DATE = ((Get-Date).AddDays(-4).ToString(&quot;yyMMdd&quot;))
  $TODAY_DATE = (get-date).ToString(&quot;yyMMdd&quot;)
  $TXT_FILES = Get-ChildItem -Path C:\temp\*
  
  $DATA = $TXT_FILES.Name -filter &quot;*d$TODAY_DATE*&quot;
  
  if ($data -like &quot;*d$DATA_DATE*&quot;) -and ($data -le &quot;*d$DATA_DATE*&quot;){
  
      Write-Output &quot;$data&quot;
  }
  </code></pre>
  <p>I would like TRUE everytime. Please help for the life of me I cannot figure this out...
  Thank you in advance!!</p>