Skip to content

Commit 034a939

Browse files
Update File System.ps1
Fixes Depth param being used when Recurse was disabled on system
1 parent 76cc8ac commit 034a939

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

File System.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,13 @@ function Idm-ExplicitACEsRead {
336336
Force = $true
337337
LiteralPath = $path_spec.path
338338
Recurse = $system_params.recursive
339-
Depth = $system_params.recursion_depth
339+
Depth = 0
340340
ErrorAction = 'SilentlyContinue'
341341
}
342+
343+
if($system_params.recursive) {
344+
$gci_args.Depth = $system_params.recursion_depth
345+
}
342346

343347
if ($path_spec.depth -ge 0) {
344348
$gci_args.Depth = $path_spec.depth
@@ -512,9 +516,13 @@ function Idm-FoldersRead {
512516
Force = $true
513517
LiteralPath = $path_spec.path
514518
Recurse = $system_params.recursive
515-
Depth = $system_params.recursion_depth
519+
Depth = 0
516520
ErrorAction = 'SilentlyContinue'
517521
}
522+
523+
if($system_params.recursive) {
524+
$gci_args.Depth = $system_params.recursion_depth
525+
}
518526

519527
if ($path_spec.depth -ge 0) {
520528
$gci_args.Depth = $path_spec.depth

0 commit comments

Comments
 (0)