• Wincent
    Open
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

Sorting filenames by length of stringEdit

12/4/2020

I say "filenames" but is really could be any string.

Motivating use case: figuring out where the cut-off point is for filepaths in a Git repo overflowing the maximum permitted length on a Windows file system (example CI failure here).

git ls-files | perl -e 'print sort { length($b) <=> length($a) } <>'

Via: Stack Overflow

  • wiki
Site
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Keybase
Colophon

Made by Greg Hurrell using React, Relay and GraphQL (with help from Git, Redis and Neovim).