Powershell File – Dateien suchen

Dateien suchen mit der Powershell

Get-ChildItem –Recurse | where {$_.extension –eq “.pdf” –and $_.LastWriteTime.Year –gt 2016}

Get-ChildItem –Recurse | where {$_.extension –eq “.pdf”}

Get-ChildItem –Recurse | where {$_.extension –eq “.pdf” –and $_.LastWriteTime –gt (Get-Date).AddDays(-10)}

Get-ChildItem “D:\Data\Desktop” | where name -like “*.Dateityp”

Clear-Host
$Directory = “D:\Data\Desktop*”
Get-ChildItem -path $Directory -Recurse| Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)}

Clear-Host
$Directory = “D:\Data\Desktop*”
$time = (Get-Date).AddDays(-60)
$size = 2MB
Get-ChildItem -Path $Directory -Recurse | `
Where-Object {$_.LastWriteTime -lt $time -and $_.Length -gt $size} | Out-File c:\Temp\test2.txt

Powershell File – Dateien suchen