Command to find file/path lengths that are too long for burning to DVD

filenamesfindtext processing

I'm trying to burn a DVD from Windows but it fails because the full path name length exceeds the limit of something like 255 characters.

Our files are stored in Debian Linux (accessed by Windows using samba), so to avoid running some dodgy Windows app to find long path names I'd prefer to find them using a Linux command.

What command could I run to output a list of the relative path and file names for a given folder, sorted by the length of each (in descending order)?

The output should look something like this:

92 ./site/testapidocs/wjhk/jupload2/policies/class-use/DefaultUploadPolicy_WithoutAlertBox.ht
83 ./site/testapidocs/wjhk/jupload2/upload/class-use/PacketConstructionThreadTest.html
76 ./site/apidocs/wjhk/jupload2/upload/helper/class-use/ProgressBarManager.html
52 ./site/xref/wjhk/jupload2/gui/JUploadFileFilter.html
31 ./site/samples.java/applet.jnlp
17 ./site/index.html

Best Answer

With GNU find (on Linux or Cygwin), you can look for files whose relative path is more than 255 characters long:

find -regextype posix-extended -regex '.{257,}'

(257 accounts for the initial ./.)

Related Question