title: powershell : get-date.adddays incorrect?
body: <p>What I'm trying to do is create a PowerShell script which gets a list of folders in a directory which is filtered by a regular expression screening out folder names with nnnnnnx31 or nnnnnnddd where n = alpha chars for the first 6 characters and the last 3 is either numbers of the static string x31.  Next it screens if the files are 90 days old which will be copied to a different directory.  </p>
  
  <p>When i try to run:</p>
  
  <pre><code>get-childitem | where {$_.name -match "^\d{6}([a-zA-Z]{3}|x31)$"} | where {$_.lastwritetime -lt (get-date.adddays(-90)}
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>You must provide a value expression on the right-hand side of the -lt operator
  At line: 1 char: 96
  + get-childitem | where {$_.name -match "^\d{6}([a-zA-Z]{3}|x31)$"} | where {$_.lastwritetime -lt  &lt;&lt;&lt;&lt; get-date.adddays(-90)}
  </code></pre>
  
  <p>I also tried the following and it didn't work:</p>
  
  <pre><code>get-childitem | where {$_.name -match "^\d{6}([a-zA-Z]{3}|x31)$"} | where {$_.lastwritetime -lt (get-date | foreach-object {$_.adddays(-90)}) }
  </code></pre>
  
  <p>Any ideas?</p>