Solved

Script to list long file paths

Posted on 2016-11-01
3
31 Views
Last Modified: 2016-11-02
Can someone suggest a PowerShell script that will list all file paths over 260 characters in the current folder and subfolders?
0
Comment
Question by:McThump
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Jason Crawford earned 500 total points
ID: 41869603
This will write to console the full path of any file with a path containing greater than 260 characters

foreach ($file in (Get-ChildItem 'c:\insert\path' -Recurse)) {
  if ($file.fullname.length -gt 260) {
    Write-Host $file.fullname
  }
}

Open in new window

2
 
LVL 5

Expert Comment

by:Antzs
ID: 41869622
Try this in PowerShell.

Out-File c:\OutputFile.txt ; cmd /c "dir /b /s /a" | ForEach-Object { if ($_.length -gt 250) {$_ | Out-File -append c:\OutputFile.txt}}
1
 
LVL 14

Expert Comment

by:Jason Crawford
ID: 41870852
Glad I could help.  Take care :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now