Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Q:Test20181217SU_1385185.ps1
- $Base = 'C:Test'
- $ArchiveFolder = $Env:tmp
- function Archive-Tree {
- $File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
- Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
- $File
- }
- ## ----- get most recent file Tree_*.clixml
- $File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
- if ($File){
- $Old = Import-Clixml $File
- $New = Import-Clixml (Archive-Tree)
- Compare-Object -Ref $Old -Dif $New -Property FullName,
- Length,LastWriteTime,CreationTime,LastAccessTime |
- Sort-Object FullName,SideIndicator | Format-Table -AutoSize
- } else {
- $File = (Archive-Tree)
- "No saved tree, now created as {0}" -f $File
- }
- FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
- -------- ------ ------------- ------------ -------------- -------------
- C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
- C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
- C:Testfoo.baz 1164 2018-12-17 13:55:05 2018-12-17 13:55:21 2018-12-17 13:55:21 =>
Add Comment
Please, Sign In to add comment