polylines tooltip content
This commit is contained in:
42
tree_included.ps1
Normal file
42
tree_included.ps1
Normal file
@@ -0,0 +1,42 @@
|
||||
param (
|
||||
[string]$Path,
|
||||
[string[]]$Include
|
||||
)
|
||||
|
||||
function Get-IncludedTree {
|
||||
param (
|
||||
[string]$Directory,
|
||||
[string[]]$Include,
|
||||
[int]$Indent = 0
|
||||
)
|
||||
|
||||
# Check if the current directory should be included
|
||||
$includeCurrent = $false
|
||||
foreach ($include in $Include) {
|
||||
if ($Directory -like "*\$include*") {
|
||||
$includeCurrent = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($includeCurrent) {
|
||||
# Output the current directory with indentation
|
||||
Write-Host (" " * $Indent) + "+---" + (Split-Path -Leaf $Directory)
|
||||
|
||||
# Process subdirectories and files
|
||||
Get-ChildItem -Path $Directory | ForEach-Object {
|
||||
if ($_.PSIsContainer) {
|
||||
Get-IncludedTree -Directory $_.FullName -Include $Include -Indent ($Indent + 4)
|
||||
} else {
|
||||
Write-Host (" " * ($Indent + 4)) + "+---" + $_.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Start processing from the given path
|
||||
Write-Host "Starting at path: $Path"
|
||||
Get-ChildItem -Path $Path -Directory | ForEach-Object {
|
||||
Get-IncludedTree -Directory $_.FullName -Include $Include
|
||||
}
|
||||
Write-Host "Processing completed."
|
||||
Reference in New Issue
Block a user