I am testing a Power Shell script to clean out a folder and I noticed some unexpected (to me) behavior when i used the - recurse flag
I have read the help files and done some searching but cant find an explanation for what is happening here.
Consider these 3 Power Shell commands:
Get-ChildItem -Path C:\folderThatDoesNotExist -recurse
Get-ChildItem -Path C:\folderThatDoesNotExist\ -recurse
Get-ChildItem -Path C:\folderThatDoesNotExist\* -recurse
The first command appears to search all of C:\ and there are a bunch of access denied errors for folders outside C:\folderThatDoesNotExist (eg c:\windows)
The second errors out with c:\f does not exist
The third errors out with c:\folderThatDoesNotExist\ not found
I expected all 3 to give an error of c:\folderThatDoesNotExist\ Path not found. Why do the first 2 give different errors?
-Include *
. – user4003407