Home Dashboard Directory Help
Search

DirectoryInfo object Length property is 1 by Bill_Stewart


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 836319
Opened: 3/18/2014 1:05:47 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

In PowerShell 2.0, DirectoryInfo objects don't have a Length property (as expected):

PS C:\> (get-item MyDir).Length
PS C:\>

In PowerShell 3.0, DirectoryInfo objects have a Length property (Int32) of 1:

PS C:\> (get-item MyDir).Length
1
PS C:\>

This seems peculiar. I don't know whether this problem occurs in PowerShell 4.0 or not.
Details
Sign in to post a comment.
Posted by Bill_Stewart on 3/18/2014 at 2:46 PM
This is a duplicate of https://connect.microsoft.com/PowerShell/feedback/details/793560/ps3-length-property-added-to-all-objects-should-be-pscount

Agree with 793560 that a different property name should have been chosen.
Sign in to post a workaround.