Eggins.com
Powershell, .Net, Visual Studio, Team Foundation Server, Windows Communication Foundation

Powershell - Get longest path length

Windows has a path length limit of 255 chars. If you are going to copy a bunch of files around that are contained within a deep hierarchy, you run the risk of hitting this limit.

To check the length of the longest file name including the entire path length, use this PowerShell script.

cd "C:\MyDir"
$len=0;dir -r|%{if ($_.FullName.Length -gt $len) {$len=$_.FullName.Length}};$len


Posted Apr 04 2007, 01:59 PM by David
Filed under:

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Copyright eggins.com, 1998 - 2008
Powered by Community Server (Non-Commercial Edition), by Telligent Systems