JSI Tip 7944. How can I report all folder paths that exceed a given length?

I have scripted PathGTR.bat to report all folder paths that exceed a specified number of characters.

The syntax for using PathGTR.bat is:

pathgtr DriveLetter NumberOfCharacters

where DriveLetter is the drive letter of the partition you wish to search, and NumberOfCharacters is the number of characters that must be exceeded for the path to be reported on the console.

NOTE: To report to a file, use pathgtr DriveLetter NumberOfCharacters>ReportFile

NOTE: PathGTR.bat uses VarLen.bat.

PathGTR.bat contains:

@echo off
if \{%2\}==\{\} goto error
set drive=%1
set drive=%drive:~0,1%:\*.*
set /a size=100000%2%%100000
for /f "Tokens=*" %%a in ('dir %drive% /b /s') do call :full "%%a"
exit /b 0
@echo Syntax: PathGTR DriveLetter PathSize
exit /b 1
set folder=%~DP1
set fldr=%folder:\=%
call varlen fldr len
if %len% GTR %size% @echo Path: "%folder%"

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.