[quote quote=132959]It seems to be like lit on StackOverflow already said – you cannot detect if it’s a container or a file if it’s not existing yet.
[/quote]
Ok then if IsValid is not able to make the difference between a leaf and a container, then it doesn’t make sense to have both IsValid and PathType in the same parameter set and they should be mutually exclusive.
Might be a good idea, I suppose. But yeah, since a file can in principle simply not have any extension and still be a file, it’s impossible for the cmdlet to determine whether a given arbitrary path would be an invalid leaf.
Mind you, in Windows file systems </code> isn’t a valid filename character so it could try to use that, but then you run into issues with other file systems using different path-separators. Perhaps in combination with this PR it could use that to determine, however?