mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
win_find: fix for empty nested directories (#26164)
This commit is contained in:
parent
0a15ab7ce9
commit
98fc54f02d
2 changed files with 39 additions and 26 deletions
|
@ -269,8 +269,8 @@ Function Get-FileStat($file) {
|
|||
$file_stat.sharename = $share_info.Name
|
||||
}
|
||||
|
||||
#$dir_files_sum = Get-ChildItem $file.FullName -Recurse | Measure-Object -property length -sum
|
||||
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
|
||||
# only get the size of a directory if there are files (not directories) inside the folder
|
||||
$dir_files_sum = Get-ChildItem $file.FullName -Recurse | Where-Object { -not $_.PSIsContainer }
|
||||
|
||||
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
|
||||
$file_stat.size = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue