title: Output files with path length greater than x
body: <p>I am trying to output to a text file, all files on a network drive which have a path length greater than x (currently 250).</p>
  
  <p>I have been trying to use the below solution that rerun posted:</p>
  
  <p><a href="https://stackoverflow.com/questions/12697259/how-do-i-find-files-with-a-path-length-greater-than-260-characters-in-windows">How do I find files with a path length greater than 260 characters in Windows?</a></p>
  
  <pre><code>In powershell cmd /c dir /s /b |? {$_.length -gt 250}
  </code></pre>
  
  <p>This solution seems to work but has two problems:</p>
  
  <ul>
  <li>It is displayed in the Powershell window, not output to a file</li>
  <li>Powershell formats the windowed results so that one file path is shown over multiple lines. I tried to copy and paste the results from Powershell into an Excel document, but they are pasted over multiple lines in Excel too, and I need each file path on one line</li>
  </ul>
  
  <p>I have changed this solution supplied by rerun to the below:</p>
  
  <pre><code>cmd /c dir /s /b |? {$_.length -gt 250} | Out-File C:\results.txt -width 1500
  </code></pre>
  
  <p>This now resolves the above two problems, but I run into another issue. I get an error message in the Powershell window when I run it, saying 'The directory name xxxxxxxx is too long'. Checking the file reveals that not all the files have been output to it. Does anybody have an idea of how I can achieve this please?
  Cheers</p>