Posted by JasonMArcher on Thu 26th Jan 21:53
View followups from JasonMArcher | download | new post
- Function RemoveOldDFSFiles{
- $global:FridayBackups = gci "E:\Data\Prodbackups\Confluence_Backup" | Where-Object {$_.CreationTime.Dayofweek -like "Friday"} | Sort-Object -property Creationtime -Descending
- $global:DFSFiles = gci "G:\Confluence_Backup" | Where-Object {$_.PSISContainer}
- $global:OldDFSFiles = $DFSFiles | Where-Object { ($FridayBackups[0..5] | Select-Object -ExpandProperty Name) -NotContains $_.Name}
- Foreach ($item in $OldDFSFiles){
- Remove-Item $item.Fullname -recurse
- if ($?) {
- @{File = $_.FullName; Removed = $true}
- } else {
- @{File = $_.FullName; Removed = $false}
- }
- }
- ## Function will "return" hashtable that represent each file
- }
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.