I am writing a recursive function that goes through a directory and copies every file and folder in it. The first check I have in the function is to see if the path passed i
Try $pathChildren.Count instead of $pathChildren.Length - that will return the number of items in the array.
$pathChildren.Count
$pathChildren.Length