mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
win_find: fix for empty nested directories (#26164)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user