June 20, 2018 at 3:45 am
$Header = @"
<style>
TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED;}
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
</style>
"@
$root = @("\\ABC\DEF\GEF\A-B")
$root1=@("\\ABC\DEF\GEF\EB-1\02132017")
$root2=@("\\ABC\DEF\GEF\1SQL")
$root3=@("\\ABC\DEF\GEF\2O")
$root4=@("\\ABC\DEF\GEF\C1")
$root5=@("\\ABC\DEF\GEF\CD")
$root6=@("\\ABC\DEF\GEF\E5")
$root7=@("\\ABC\DEF\GEF\YM")
$root8=@("\\ABC\DEF\GEF\E0")
Get-ChildItem -Path "\\ABC\DEF\GEF" -Recurse -exclude Readme.txt| Sort-Object Length -Descending |Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-2) -and $_.FullName -notlike "*$root*" -and $_.FullName -notlike "*$root1*" -and $_.FullName -notlike "*$root2*" -and $_.FullName -notlike "*$root3*" -and $_.FullName -notlike "*$root4*" -and $_.FullName -notlike "*$root5*" -and $_.FullName -notlike "*$root6*" -and $_.FullName -notlike "*$root7*" -and $_.FullName -notlike "*$root8*" }|Select-Object FullName,Length, LastWriteTime | ConvertTo-Html -Property FullName,Length,LastWriteTime -Head $Header |Out-File \\ABC\DEF\GEF\2Ol\ds_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).'html'
The above code gives me a HTML report with files older than 2 days.
It also includes empty folders.
How can I display only files and not empty folders.
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply