Windows和Unix上的文件名是255个字符限制的整个路径,还是路径的一部分? [英] Is the 255 char limit for filenames on Windows and Unix the whole path, or part of path?

查看:191
本文介绍了Windows和Unix上的文件名是255个字符限制的整个路径,还是路径的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows NTFS和Unix上,文件名的255个字符限制是整个路径还是路径的一部分?



即给定的c:\part1\part2只是part1和part2得到少于255或者是C:\ + part1 + part2



Unix上的规则是什么?

$ b $除了上面的答案,你还必须考虑到正在使用的文件系统(ext2等)。 Unix没有标准的答案。 Linux对于每个组件通常是255,对于完整路径是4096,对于路径是无限制的。其他Unix变体使用不同的限制。 OSX与HFS +是255文件名和1024或无限路径(我找不到明确的答案)。除非你是正面的,否则你只需要担心Linux,你可能会想保持整个路径低。如果可能的话,将整个路径限制为255是个不错的主意。您可能还需要考虑到文件系统可以挂载网络,而NFS,SMB等也有自己的限制。



Unix的简短答案是没有简短的答案,也没有标准,操作系统和底层文件系统都受到限制。

Is the 255 char limit for filenames on Windows NTFS and Unix the whole path, or part of path ?

i.e given c:\part1\part2 have just part1 and part2 got to be less than 255 or is it C:\ + part1 + part2

And whats the rules on Unix ?

解决方案

In addition to the answers above, you also have to account for the filesystem being used (ext2, etc.). There's no standard answer for Unix. Linux is generally 255 per component and either 4096 for the full path, or unlimited for the path. Other Unix variants use different limits. OSX with HFS+ is 255 filename and either 1024 or unlimited path (I can't find a definitive answer). Unless you're positive you only have to worry about Linux, you'll probably want to keep the overall path low just to be sure. It's not a bad idea to limit the entire path to 255 if possible. You may also need to consider that filesystems can be network-mounted, and NFS, SMB, etc. have their own limits.

The short answer for Unix is that there is no short answer nor is there a standard, and both the operating system and the underlying filesystem impose restrictions.

这篇关于Windows和Unix上的文件名是255个字符限制的整个路径,还是路径的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆