fix: Check folder and child count before recursing in Get-XlsFilesRecursive
This commit is contained in:
parent
6bda577ba3
commit
aed44fc07d
@ -307,7 +307,7 @@ function Get-XlsFilesRecursive {
|
|||||||
$script:txtStatus.Text += "Checking item: $($item.Name)`n"
|
$script:txtStatus.Text += "Checking item: $($item.Name)`n"
|
||||||
|
|
||||||
# If it's a folder, recurse into it
|
# If it's a folder, recurse into it
|
||||||
if ($item.Folder) {
|
if ($item.Folder -and $item.Folder.ChildCount -ne $null) { # Check if it's a folder AND has children
|
||||||
$script:txtStatus.Text += "Found folder: $($item.Name), recursing...`n"
|
$script:txtStatus.Text += "Found folder: $($item.Name), recursing...`n"
|
||||||
$allFiles += Get-XlsFilesRecursive -DriveId $DriveId -DriveItemId $item.Id
|
$allFiles += Get-XlsFilesRecursive -DriveId $DriveId -DriveItemId $item.Id
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user