What is the digit limit in file/folder names on EOS?

Hi friends.

I read somewhere that there was a digit limit for folders and files and that you should not exceed that limit.

What would be the limit on EOS and what happens if it is exceeded?

I am downloading files and folders with very long names and I don’t know if this could be a problem.

Thanks in advance.

If you’re using ext4, then the filename length is capped at 255bytes by default. Assuming you use only ASCII characters in the filename, each character takes 1byte. So, 255 characters max. If you use Unicode characters (eg. characters with diacritics, non-english languages, emojis etc) then single character will take more bytes.

The same goes for btrfs afaik.

Edit:

$ cat /usr/src/linux-lts/include/uapi/linux/limits.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_LIMITS_H
#define _UAPI_LINUX_LIMITS_H

#define NR_OPEN	        1024

#define NGROUPS_MAX    65536	/* supplemental group IDs are available */
#define ARG_MAX       131072	/* # bytes of args + environ for exec() */
#define LINK_MAX         127	/* # links a file may have */
#define MAX_CANON        255	/* size of the canonical input queue */
#define MAX_INPUT        255	/* size of the type-ahead buffer */
#define NAME_MAX         255	/* # chars in a file name */
#define PATH_MAX        4096	/* # chars in a path name including nul */
#define PIPE_BUF        4096	/* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX   255	/* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536	/* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536	/* size of extended attribute namelist (64k) */

#define RTSIG_MAX	  32

#endif

There’s also a maximum path length limit of 4096 characters.

2 Likes

You will get the error File name too long when you try to write the file.

2 Likes

Thank you both very much, friends!

I’m trying to make a “database” of files, manually, on EOS with EXT4, and some files seemed to have quite a long name, but they don’t reach 255, so that won’t be a problem.

I also have another question, what letters, signs or symbols are not allowed or recommended to name folders and files in EOS?

I mean, when I used Windows, there were many signs that I couldn’t put them in the names of files/folders/paths.

So I have seen on EOS that there are some hidden folders that have “.” in front of the name, so I guess if I rename a folder with “.” in front of the name, it will be hidden. So there must be some characters that I shouldn’t use in EOS for files/folders.

I have searched for info and Google says that in Linux you can use “all” characters unlike Windows, but I am not sure about this.

The folders/files I want to rename could have some strange characters and inside another folder with a name similar to this:

asd.qwe_123 / 25ce6c32-ca95-4e6a-b315-29a662a31e21 / file.zip

Thanks again!

You cannot use a “/” in the file name because that is used as a directory delimiter in Linux. Technically you can use a “\”, but you would have to escape it first (so you would write it as “\\”). I would suggest just not using any slashes in your file name.

You can use spaces, but when you refer to them on the command line or in scripts you must escape the spaces with a “\” like this:

file\ name\ with\ spaces

Or quote the file name:

'file name with spaces'

You can use a period in a file name, but be aware the period also has specific meanings of its own–for example, to mark a hidden file like you mentioned, or to mark a file’s extension.

If “asd.qwe_123” and “25ce6c32-ca95-4e6a-b315-29a662a31e21” are directories, and “file.zip” is a file inside, then this is fine (except the “padding” spaces should not be in the path).

If that is meant to be all one long file name, it will cause issues unless you remove the slashes from it and use dashes (“-”) or something else instead.

1 Like