Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $Path = "$Home\Documents\WindowsPowerShell\tmp"
  2. $ExcludeFiles = '*.psm1'
  3. $IncludeFiles = '*.ps1'
  4.  
  5. #Bad way!
  6. If($ExcludeFiles)
  7. {
  8. if($IncludeFiles)
  9. {
  10. $Files = Get-ChildItem -Path $Path -Recurse -Include $IncludeFiles
  11. }
  12. else
  13. {
  14. $Files = Get-ChildItem -Path $Path -Recurse
  15. }
  16. }
  17. else
  18. {
  19. if($IncludeFiles)
  20. {
  21. $Files = Get-ChildItem -Path $Path -Recurse -Exclude $ExcludeFiles -Include $IncludeFiles
  22. }
  23. else
  24. {
  25. $Files = Get-ChildItem -Path $Path -Recurse -Exclude $ExcludeFiles
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement