top of page
  • Writer's pictureChris 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.


Syntax

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


Description

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


Examples

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

Parameters


-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


3,154 views0 comments
bottom of page