?
Solved

Script to list long file paths

Posted on 2016-11-01
3
Medium Priority
?
63 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
Jason Crawford earned 2000 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 9

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 16

Expert Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

771 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