Guest User

Untitled

a guest
Dec 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. ## Q:Test20181217SU_1385185.ps1
  2. $Base = 'C:Test'
  3. $ArchiveFolder = $Env:tmp
  4.  
  5. function Archive-Tree {
  6. $File = "{0}Tree_{1:yyyyMMddHHmmss}.CliXML" -f $ArchiveFolder,[datetime]::Now
  7. Get-ChildItem -Path $Base -Recurse | Export-Clixml $File
  8. $File
  9. }
  10.  
  11. ## ----- get most recent file Tree_*.clixml
  12. $File = Get-ChildItem "$($Env:tmp)Tree_*.Clixml" | Select-Object -Last 1
  13. if ($File){
  14. $Old = Import-Clixml $File
  15. $New = Import-Clixml (Archive-Tree)
  16. Compare-Object -Ref $Old -Dif $New -Property FullName,
  17. Length,LastWriteTime,CreationTime,LastAccessTime |
  18. Sort-Object FullName,SideIndicator | Format-Table -AutoSize
  19. } else {
  20. $File = (Archive-Tree)
  21. "No saved tree, now created as {0}" -f $File
  22. }
  23.  
  24. FullName Length LastWriteTime CreationTime LastAccessTime SideIndicator
  25. -------- ------ ------------- ------------ -------------- -------------
  26. C:testc_test.clixml 982258 2018-12-17 12:59:27 2018-12-17 12:59:24 2018-12-17 12:59:24 =>
  27. C:testc_test.clixml 0 2018-12-17 12:59:24 2018-12-17 12:59:24 2018-12-17 12:59:24 <=
  28. 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