Created
February 18, 2016 10:41
-
-
Save AlexKasaku/1e4380c453b6fb8360aa to your computer and use it in GitHub Desktop.
List contents of folder, ignoring certain folders.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$source = "C:\Sites\bma8" | |
Set-Location $source | |
$ignoreFolder = @() | |
$ignoreFolder += "\Website\App_Data" | |
$ignoreFolder += "\Website\temp" | |
$ignoreFolder += "\Data\debug" | |
$ignoreFolder += "\Data\diagnostics" | |
$ignoreFolder += "\Data\indexes" | |
$ignoreFolder += "\Data\logs" | |
$ignoreFolder += "\Data\mediaIndexing" | |
$ignoreFolder += "\Data\packages" | |
$ignoreFolder += "\Data\serialization" | |
$ignoreFolder += "\Data\Submit Queue" | |
$ignoreFolder += "\Data\viewstate" | |
filter Where-NotIgnored { | |
foreach( $folder in $ignoreFolder ) { | |
if ($_.FullName -match [Regex]::Escape($source + $folder) ) { | |
return | |
} | |
} | |
$_ | |
} | |
Get-ChildItem -Recurse | Where-NotIgnored | Foreach-Object {$_.FullName} > C:\temp\pslist.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment