Tuesday, 10 September 2013

Driectory does not met Test-Path $item -PathType Container

Driectory does not met Test-Path $item -PathType Container

According to this website, every folder should met the following condition:
if (Test-Path $item -PathType Container)
{
"TRUE: " + $item.Name
}
else
{
"FALSE: " + $item.Name
}
But for me that is not true, some folders are true while others are false.
This is my whole script:
function GetFiles($path = $pwd)
{
foreach ($item in Get-ChildItem $path)
{
if (Test-Path $item -PathType Container)
{
"TRUE: " + $item.Name
GetFiles $item.FullName
}
else
{
"FALSE: " + $item.Name
}
}
}
Any idea why is this happening?

No comments:

Post a Comment