Quantcast
Viewing all articles
Browse latest Browse all 26374

Deleting Backup files

I have the following code running as a scheduled task, however it does not delete any backup files from the root folder. I have a folder called PFS and runningt the code deletes the files from PFS folder but not from the D:\Backupfarm\Backupspsite root folder.

Add-PsSnapin Microsoft.SharePoint.PowerShell
get-childitem D:\Backupfarm\Backupspsite -recurse | where {$_.lastwritetime -lt (get-date).adddays(-7) -and -not $_.psiscontainer} |% {remove-item $_.fullname -force}


Viewing all articles
Browse latest Browse all 26374

Trending Articles