Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f1.txt
- f2
- f3.jpg
- -- begin exclusions.txt --
- a.txt
- b.txt
- c.txt
- -- end --
- # read all exclusions into a string array
- $exclusions = Get-Content .exclusions.txt
- dir -rec *.* | Where-Object {
- $exclusions -notcontains $_.name } | `
- Remove-Item -WhatIf
- Get-ChildItem -exclude (gc exclusions.txt) | Remove-Item -whatif
- $exclusions = Get-Content .exclusions.txt
- dir -rec | where-object {-not($exclusions -contains [io.path]::GetFileName($_))} | `
- where-object {-not($_ -is [system.IO.directoryInfo])} | remove-item -whatif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement