• Chris Keim

How to Find File and Folder Path Lengths Recursively using PowerShell (Get-LongPaths)

Sometimes users like to get wordy with file paths. This is usually no problem especially if you enable long file path support. But, what if you are using a program that doesn't support long file path names? Easy, just find the long file paths and shorten them. Easier said then done when working with a file server. This script recursively finds paths over a specific length recursively.


Get-LongPaths -Path <string> -Length <integer>


The Get-LongPaths cmdlet finds all paths recursively over a specified length and outputs to a grid view.


Example 1: Find all paths over 256 characters recursively starting with the root directory D:\Shares.

Example 2: Find all paths over 100 characters recursively starting with the root directory D:\Departments


-Path (Mandatory)

Specifies the root path to search recursively.

-Length (Optional)

Specifies the path character limit before the path is reported by the function.

PowerShell Script

21 views0 comments