Flappy Shoot

Tuesday, June 15, 2010

Delete files with the name starting with public which last accessed time was 3 days before.

Get-ChildItem \\fpdftp01\EXPRESS `
| Where-Object {$_.name -match "public*" -and $_.PSIsContainer -eq `
$false -and [datetime]::now.adddays(-3) -gt $_.LastaccessTime} `
| foreach ($_) {remove-item $_.fullname -ErrorAction SilentlyContinue `
-Force}

No comments: