powershell : get-date.adddays incorrect? -


What I'm trying to do is create a PowerShell script that receives a list of folders in a directory that is a Nnnnnnnxx or nnnnnnddd with regular expression screening outside the folder name, where n = alpha characters for the first 6 characters and the last 3 is the number of stable string x31, if these files are 90 days old, then it is in a separate directory on the screen Will be copied

When I try to run:

  Mill-Balitam | Where {$ _. Name-match "^ \ d {6} ([a-zA-Z] {3} | x31) $"} | Where {$ _. Lastwritetime -lt (get-date.adddays (-90)}  

I get an error:

  You must provide a value -lt operator's On the expression line on the right hand: 1 four: 96 + go- baalitam | where {$ _ .nam-match "^ \ d {6} ([a-zA-Z] {3} | X31) $"} | where {$ _ Last time-lt  

I also tried the following and it does not work: < / P>

  get-childitem | where {$ _ .nam-match "^ \ d {6} ([a-zA-Z] {3} | x31) $"} | Where {$ _ Last Vime Time-LT (Match-Date | Forward-Object {$ _. Ad Any idea?   

P> You must be (date of receiving). Adidas (-90)


Comments