Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Recursive Delete Script Returns 'Specified Method Is Not Supported'

$
0
0

I have the following cleanup script, pretty simple to delete files older than 90 days.  The script works on two other folder paths in the same drive letter path on the same server.  This one, however returns the, "Specified method is not supported" error.

The two folders that this worked on had just over 200 and 350 files.  The folder this is not working on has 1099 files in it.

$Path = "E:\MyServerNameShare\File_Archive\IDI_Archive"
$Daysback = "-90"
$CurrentDate = Get-Date
$DatetoDelete = $CurrentDate.AddDays($Daysback)

Get-ChildItem $Path | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item

Any assistance would be highly appreciated - Thank you.


Viewing all articles
Browse latest Browse all 6937

Trending Articles