JSI Tip 10141. How can a batch report on all file / folder paths that exceed the 255 character limit?


I have scripted Xlong.bat to report all file / folder paths that exceed the 255 character limit on a specified drive.

The syntax for using Xlong.bat is:

Xlong DriveLetter

Where DriveLetter is the drive letter, like C: or D:.

Xlong.bat contains:

@echo off
if \{%1\}

\{\} @echo Syntax: XLong DriveLetter&goto :EOF setlocal EnableDelayedExpansion set wrk=%1 set wrk=%wrk:"=% if "%wrk%" EQU "" @echo Syntax: XLong DriveLetter&endlocal&goto :EOF set drv=%wrk:~0,1%:if not exist %drv% @echo Syntax: XLong DriveLetter&endlocal&goto :EOF for /F "Tokens=*" %%a in ('dir %drv% /b /s /a') do ( set name=%%a if not "!name:~255,1!"

"" echo Excessively long name: "%%a" ) endlocal



Hide comments

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.
Publish