Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. f1.txt
  2. f2
  3. f3.jpg
  4.  
  5. -- begin exclusions.txt --
  6. a.txt
  7. b.txt
  8. c.txt
  9. -- end --
  10.  
  11. # read all exclusions into a string array
  12. $exclusions = Get-Content .exclusions.txt
  13.  
  14. dir -rec *.* | Where-Object {
  15. $exclusions -notcontains $_.name } | `
  16. Remove-Item -WhatIf
  17.  
  18. Get-ChildItem -exclude (gc exclusions.txt) | Remove-Item -whatif
  19.  
  20. $exclusions = Get-Content .exclusions.txt
  21.  
  22. dir -rec | where-object {-not($exclusions -contains [io.path]::GetFileName($_))} | `
  23. where-object {-not($_ -is [system.IO.directoryInfo])} | remove-item -whatif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement