How to find files whose paths are too long

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 16,981
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #11

    svanslyck said:
    How do I specify the output filename?
    Just as I showed in my example.
    Code:
     | Export-CSV "$OutputPath\LongFilePaths-$LengthThreshold.csv"
    See
    Export-Csv - SS64

    Export-Csv - MSDocs - I normally find SS64 explanations better than MS's but, in this case, take a look in the MSDocs/MSLearn article aswell because it explains the very useful /Append switch.


    Denis
      My Computer


  2. Posts : 3
    W10 64 Pro
       #12

    svanslyck said:
    How do I specify the output filename?
    I don't understand how to do that.
      My Computer


  3. Posts : 754
    Windows 10/11
       #13

    svanslyck said:
    I don't understand how to do that.
    The script is already provided for you in message #9. Just edit the filename in the last line of the script. If you're looking to provide the output filename as a command line argument to the script, that can be done too. Please clarify your requirements.
      My Computer


  4. Posts : 16,981
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #14

    svanslyck said:
    How do I specify the output filename?
    In the posted script,
    Code:
    # Change $ExaminedPath & $OutputPath to wherever you want and change $LengthThreshold to anything up to the full filepath max. of 256 characters
    $ExaminedPath = "C:\Users\user\Documents"
    $OutputPath = "C:\Users\user\Desktop"
    $LengthThreshold = 200
    Get-ChildItem $ExaminedPath -Recurse | Where-Object  {$_.Name.Length -gt $LengthThreshold} | select Directory, FullName | Export-CSV "$OutputPath\LongFilePaths-$LengthThreshold.csv" -NoTypeInformation
    - Look at line two. Replace "C:\Users\user\Documents" with the real path to the folder you want to examine files in.
    - Look at line three. Replace "C:\Users\user\Desktop" with the real path to the folder you want to save the output file in.
    - There is no need to change line four. You could if you wanted to.
    - There is no need to change line five. You could if you wanted to. But why bother? Just accept the output filename I wrote into that line.


    Denis
      My Computer


  5. Posts : 3
    W10 64 Pro
       #15

    Thank you, Denis, I did do that but no file showed up. I don't see a filename specified in the code, so I'm assuming that that (no specified filename) is the problem.

    Hmmmm. Just tried it at home and it worked. Maybe I'm running the wrong powershell.
      My Computer


  6. Posts : 16,981
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #16

    svanslyck said:
    Just tried it at home and it worked. Maybe I'm running the wrong powershell.
    I think it's likely to be an error in specifying lines 2 or 3, the folder to be examined or the folder to send the results to.

    svanslyck said:
    I don't see a filename specified in the code
    Well, it is. It's on line five.
    Code:
    LongFilePaths-$LengthThreshold.csv
    The $LengthThreshold bit just writes in the value of the path length you chose in line four so you get a filename like
    Code:
    LongFilePaths-200.csv
    All the best,
    Denis
      My Computer


  7. Posts : 320
    Windows 10
       #17

    Since there are all Quack Quack $#@$@# @#$#$@ short-form names for everything. You should try

    "Rapid Environment Editor" ( use with administrator privileges )

    You can literally use this to short form every or anything written into path.

    Path is limited by a certain amount of characters and in order to extend you have to create and extension within path to another
    path.

    Path can be edited for a local account ( usually on the right side ) or even system-wide ( true hidden administrators account included on the left side most of the time ).

    I am saying to use "Rapid environment editor" because you can short-form every single path to it's $$$##@$# notation.
      My Computer


  8. Posts : 281
    Win 10 Pro 21H2 (OS Build 19045.3636)
       #18

    I wonder if some haven't noticed that the script scrolls to the right to show the remainder of the longer lines.
      My Computers


  9. Posts : 16,981
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #19

    tpriest said:
    I wonder if some haven't noticed that the script scrolls to the right to show the remainder of the longer lines.
    @svanslyck Is that the problem, you don't know that you need to scroll to the right to see the whole line if your browser window is too small to see the whole thing at once?

    Try3 said:
    In the posted script,
    Code:
    # Change $ExaminedPath & $OutputPath to wherever you want and  change $LengthThreshold to anything up to the full filepath max. of 256  characters
    $ExaminedPath = "C:\Users\user\Documents"
    $OutputPath = "C:\Users\user\Desktop"
    $LengthThreshold = 200
    Get-ChildItem $ExaminedPath -Recurse | Where-Object  {$_.Name.Length -gt  $LengthThreshold} | select Directory, FullName | Export-CSV  "$OutputPath\LongFilePaths-$LengthThreshold.csv"  -NoTypeInformation
    - Look at line two. Replace "C:\Users\user\Documents" with the real path to the folder you want to examine files in.
    - Look at line three. Replace "C:\Users\user\Desktop" with the real path to the folder you want to save the output file in.
    - There is no need to change line four. You could if you wanted to.
    - There is no need to change line five. You could if you wanted to. But why bother? Just accept the output filename I wrote into that line.

    And here's a copy of the script as a ps1 file.
    I assume you know how to run ps1 files. If not, you can just paste each line into a PS window one after the other after you have made any changes you need such as those two folder paths.
    List overly long folder paths.ps1


    Denis
      My Computer


  10. Posts : 281
    Win 10 Pro 21H2 (OS Build 19045.3636)
       #20

    Try3 said:
    @svanslyck Is that the problem, you don't know that you need to scroll to the right to see the whole line if your browser window is too small to see the whole thing at once?
    Denis
    That, for me, begs the question of how to make the browser window larger? Screen grab of mine here, the blue side bars extend to the edge of the monitor.

    Running Chrome Version 122.0.6261.129 on Windows 22H2 ((OS Build 19045.4170)
    Attached Thumbnails Attached Thumbnails How to find files whose paths are too long-screenshot-394-.png  
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:59.
Find Us




Windows 10 Forums