The maximum length of a directory name or file name is affected by the location itself.
The maximum length of the path to a file on a modern Operating System is 255 characters.
260 characters
Starting from /home, the path may include up to 4,091 additional characters (that is, Linux supports 4096 characters for the path, with up to 256 characters per file or directory name). This is a limitation of the kernel, and not of the file system. It is technically possible to modify the Linux kernel to support even longer file and path names if a user needed to do so.
An invalid file name is one that contains characters or formats not permitted by the operating system. For example, in Windows, file names cannot include characters like \ / : * ? " < > |. Additionally, names that are too long or use reserved names (like "CON" or "PRN") are also considered invalid. Each operating system has its own rules governing valid file names.
It depends on the file systems supported by the operating system. Most file systems use the concept of files and directories (or folders) to access data stored on a device. File names and directory names usually follow the same naming conventions on a given system. Every file and directory has a set of attribute bits (flags) associated with it and one of those attributes is the directory bit. If the bit is set, the name refers to a directory otherwise the name refers to a file.On the older MS-DOS FAT file system, file and directory names are limited to 8 characters for the base name and 3 for the extension, commonly referred to as an 8.3 file name. The dot separator is considered part of the file name, thus file names are limited to a maximum of 12 characters. The newer Windows FAT and NTFS file systems support longer file names, but in order to retain backward compatibility with the older FAT system, file names that do not conform to the 8.3 file naming convention are automatically given a second short file name that does conform. Such files can therefore be referred to by either name. For example, the "C:\Program Files" folder can be referred to as "C:\PROGRA~1". Note that any file name with a space character is considered a long file name because the 8.3 naming convention does not support space characters.You may use any characters in the current code page for a name, including Unicode characters and characters in the extended character set (128-255), except for the following characters:< (less than)> (greater than): (colon)" (double quote)/ (forward slash)\ (backslash)| (vertical bar or pipe)? (question mark)* (asterisk)In addition, the following restrictions apply:Integer value zero, sometimes referred to as the ASCII NUL character.Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed.Any other character that the target file system does not allow.The following names are also reserved and cannot be used to name a file or directory:CONPRNAUXNULCOM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8 and COM9LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9Note that although the newer FAT and NTFS file systems allow mixed-case file names, they are not case-sensitive by default. That is, "TEMP", "Temp" and "temp" all refer to the same file or directory. However, when searching for files, you can use case-sensitivity to filter out unwanted files. For example, searching for "T*" with case-sensitivity turned on will find only those files that begin with a capital 'T'.Under the newer FAT and NTFS system, the Windows API imposes a maximum length of a fully-qualified path to 260 characters including the terminating null character. Given a fully-qualified path name is of the form volume:\component(s), the maximum length for any one component (file or directory name) is 256 characters. However, the Windows API also supports Unicode versions which permit extended-length paths of up to 32,767 characters with a maximum component length of 255 characters. To specify an extended-length path, use the "\\?" prefix. For example, "\\?\D:\very long path".Note that the shell and the file system have different requirements thus it is possible to create a path using the Windows API that the shell user interface is not able to interpret correctly.
The file name must not exceed eight characters separated by a dot having up to three extension letters. Very little punctuation or special characters can be used in the name or extension other than a hyphen, tilda, brace or an underscore. In fact, if the file name is corrupted and a character you cannot type is in the name, it makes it difficult to deal with the files. There was a little trick where some users held down ALT and typed 255 on the number pad and added that character to the name. Others would see a name with a space on the end and then wonder why entering a space doesn't work. For example: abcdef12.123 hello.c readme are all valid filenames. Directories usually have a null extension, though they can have an extension. Files don't have to have an extension but usually do. For example: dir *. will display mostly directory names. In later DOS versions, you would do Dir /ad if you want directories so you won't get files that have no extensions nor exclude directories that have extensions. This command might even help find hidden directories. The 8.3 limits apply to older versions of DOS that use a FAT12 or FAT16 file system. Starting with FAT32, long filename support (LFN) was added, and a few additional characters could be used in the long file names, including spaces, and file names could be up to 64 characters long. However, there were underlying short file names that were there for reverse compatibility, and they still follow the above rules.
4096
Use the 'ls' command with the '-l' (long listing) option
Use the 'ls' command with the '-l' (long listing) option
A filename is simply a unique identifier for any file... It used to be limited to 11 characters plus a three character extension (for example computer.com) - Advances in programming now allows over 200 characters in a file name.
Use the 'ls' command with the long listing option: ls -l
AnswerAssuming you are using the NTFS file system (this is likely if you are running Windows XP, to find out for sure go to "My computer", right-click on your main hard drive, likely "C:" and click properties, the annotation next to "File System" is your answer) then the maximum number of characters in a file name is 256. Keep in mind however that if your computer hides file extensions (such as the ".exe", ".doc", etc.) those still count towards your 256 maximum (i.e. if you have a program named "test" on your desktop it would appear to only contain four characters, but in reality the full file name is "test.exe" therefore taking up a total of eight characters. The maximum is 256
NTFS-New Technology File System