Benches Uncategorized

4

-bash: File name too long

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi, I'm using some file names that are very long in a bash shell script.

I get the error -bash: File name too long and it just bails.

Does anyone know how to increase the file name length capacity of bash?

It would be really nice to have this unlimited! Is dynamic memory allocation really that hard for some people to program?

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    RayNewbie

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Length of a file name, length of a path name, and length of a command line are generally limited by the file system and the OS respectively, not by the shell. If you were able to create the files, it might be the full path name that's too long. You might try a cd into the directory, then make a temporary hard link (e.g. ln foo) to avoid exceeding the command line limit.

  2. 0

    Sean McGuffee

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Ok, well, I did figure out a temporary fix, but do you know how to adjust the length of a file name path name and command line on the file system and OS for a the long range fix. It seems silly to me to have limits on these important features of computers now that we literally have gigabytes of memory on the computers!

  3. 0

    RayNewbie

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    No, I don't know how to modify the OS, at least not in a way that would render it useful ever again.

    Btw, I tried creating and using some very long file names from my Mac 10.5.5 bash shell. I made two files, each with names over 200 chars. I used both of them in one command line (e.g. cat <file1> <file2>) and was surprised to find out it worked. The limits were much lower last time I tried that on a Unix platform.

  4. 0

    Thomas von Eyben

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The limit for a filename on HFS+ is 255 bytes.

    For at path the limit is 1024 bytes.

    http://developer.apple.com/technotes/tn/tn1150.html

    Making changes to these limits probably means to chose (or invent) a new filesystem (not a trivial task).

    Perhaps the newly created ZFS file system have larger limits?

    Message was edited by: Thomas von Eyben