-
Parameter Handling:
The function accepts one or more paths (via the-Path
parameter or through the pipeline). It also accepts a-Recurse
switch to control whether subdirectories are searched. -
Input Validation:
Each provided path is checked withTest-Path
. If a path does not exist, a warning is emitted and that path is skipped. -
Parallel Enumeration:
For each valid path, a[System.IO.DirectoryInfo]
object is created. The directories and files are enumerated usingEnumerateDirectories
andEnumerateFiles
respectively, then converted into a parallel query usingAsParallel
. -
Output:
The function concatenates the directories and files found and outputs them as a single collection.