Solved

Script to list long file paths

Posted on 2016-11-01
3
53 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 7

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.

839 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