Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

powershell script to obtain diretories older than x days

$
0
0

I must process all directories older than x days . This test-statement is ok: 

Get-Childitem -path $InputPath -recurse | where-object { $_.LastWriteTime -lt (get-date).adddays(-7) -and $_.PSIsContainer } | Out-GridView

In the script I want all directory names in $srcDir for further processing. 

$srcDir = Get-Childitem -path $InputPath -recurse | where-object { $_.LastWriteTime -lt (get-date).adddays(-7) -and $_.PSIsContainer } 

using this statement in the script I get a runtime-error. The where-object is missing an "and" parameter ??? 

Can pls. anyone help me what's wrong with this statement?

sonny 



Siegmund Sonntag


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>