Locate long file paths on external drive with terminal

disk-formatfinderhard drivepathterminal

I need to move a large volume to a new raid server that's PC formatted. However I have a couple paths and filenames that are interrupting this process.

I would just like to know how to use the terminal to:

  1. Locate the targeted external drive
  2. Then search that drive for paths/files that are over 130 characters

Can anyone help?

I know how to search for long paths find " . -type f -name '?????…*' ", just not sure how to target my external drive.

Best Answer

The external drive is mounted under /Volumes, run ls /Volumes to see the exact name.

Afterwards you can use

find /Volumes/NAME-FROM-ABOVE -print |
    while read line; do [[ ${#line} -gt 130 ]] && echo $line; done

to list all files where path and filename combined are longer than 130 characters.

PS: This will not work for file/path names containing new lines and similar stuff (which usually isn't a problem) PPS: If your volume name contains spaces you need to wrap it in "" -> find "/Volumes/LaCie - BRYT" -print ...