get-childitem - need verbose errors RRS feed

  • Question

  • How do I get more information from errors generated by get-childitem?

    get-childitem 'y:\' -recurse -force | where-object { $_.FullName.Length-ge 250 } | select-object FullName | format-list >> 'C:\output.txt'

    This picks up all the full path names thatare over 250 char in length.

    When it hits apat that is over 248 chars the error doesn't give me enough information.

    See my example where is only displays the path name in part.


    Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

        + CategoryInfo          : ReadError: (Y:\Data\New_Com...r letters & Fax:String) [Get-ChildItem], PathTooLongException

        + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChil

    Thursday, August 23, 2012 1:54 AM


  • That is correct.  YOu cannot discioover long paths from the error message.  The error is what it is.  It cannot be more verbose.  The error occurs because the API cannot retrieve the long path so how would you expect it to know what the long path is.  If it could read it then there would be no error.


    • Proposed as answer by Bigteddy Thursday, August 23, 2012 5:39 AM
    • Marked as answer by IamMred Thursday, August 23, 2012 4:16 PM
    Thursday, August 23, 2012 2:00 AM