From 85f77419cd01bec9a387da2b0d269ae4d8a416e0 Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Fri, 4 Oct 2019 14:07:20 -0600 Subject: [PATCH] Added psiscontainer clause --- New-GitHubMarkdownIndex/New-GitHubMarkdownIndex.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/New-GitHubMarkdownIndex/New-GitHubMarkdownIndex.ps1 b/New-GitHubMarkdownIndex/New-GitHubMarkdownIndex.ps1 index 93406b5..4663011 100644 --- a/New-GitHubMarkdownIndex/New-GitHubMarkdownIndex.ps1 +++ b/New-GitHubMarkdownIndex/New-GitHubMarkdownIndex.ps1 @@ -23,10 +23,12 @@ function New-GitHubMarkdownIndex { Get-ChildItem -LiteralPath $Path | ForEach-Object { $GHPath = $_.FullName -replace [regex]::Escape($Path) -replace '\\','/' -replace '\s','%20' "* [$(Split-Path $_ -Leaf)]($GitHubUri$GHPath)" - $_ | Get-ChildItem -Recurse | ? {$_.PSIsContainer -or $_.Extension -in $IncludeExtensions} | ForEach-Object { - $Count = ($_.FullName -split '\\').Count-($Path.Split('\').Count+1) - $GHPath = $_.FullName -replace [regex]::Escape($Path) -replace '\\','/' -replace '\s','%20' - "$(" "*$Count*2)* [$(Split-Path $_ -Leaf)]($GitHubUri$GHPath)" + if ($_.PSIsContainer) { + $_ | Get-ChildItem -Recurse | ? {$_.PSIsContainer -or $_.Extension -in $IncludeExtensions} | ForEach-Object { + $Count = ($_.FullName -split '\\').Count-($Path.Split('\').Count+1) + $GHPath = $_.FullName -replace [regex]::Escape($Path) -replace '\\','/' -replace '\s','%20' + "$(" "*$Count*2)* [$(Split-Path $_ -Leaf)]($GitHubUri$GHPath)" + } } } }