Locate long file paths on external drive with terminal

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.


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


The following command will print out all files that have more than 130 characters

find -E . -type f -regex '.*[^/]{130}'

The Terminal (bash) command to list the disks attached to the system is diskutil. The command diskutil list will output all disks - just select the identifier that matches your external device.

For example:

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                  Apple_HFS FreeAgent Go            499.8 GB   disk3s2
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk4
   1:                        EFI EFI                     209.7 MB   disk4s1
   2:                  Apple_HFS My Passport for Mac     999.8 GB   disk4s2

disk0, disk1, and disk2 are in a CoreStorage volume. disk3 and disk4 are my external drivers

To access the drive (assuming it's mounted), look in the /Volumes directory for the appropriate mount point.

Assuming you wanted to search "My Passport for Mac" you would enter the command:

find -E /Volumes/My\ Passport\ for\ Mac/ -type f -regex '.*[^/]{130}'