linux最大目录是什么,linux/windows中最深的目录是什么?

新技能√

以后片子又有新的方法存了。谢谢 @eccstartup

NTFS:

最长路径为 32,767 个 Unicode 字符,每个目录(或文件)的最大长度为 255 字符。

我刚才试了一下,在 E:\data 目录建了一个长度为 239 的成功了。

E:\data>md 123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

0123456789

长度为 240 的失败了

E:\data>md 123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

01234567890

文件名或扩展名太长。

当我进入子目录(239长度的那个),再新建一个长度为 1 的,失败。

E:\data>cd 123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

01234567890123456789012345678901234567890123456789012345678901234567890123456789

0123456789

E:\data\123456789012345678901234567890123456789012345678901234567890123456789012

34567890123456789012345678901234567890123456789012345678901234567890123456789012

34567890123456789012345678901234567890123456789012345678901234567890123456789012

3456789>md 1

文件名或扩展名太长。

至此,晕了。

File names are limited to 255 UTF-16 code points. Certain names are reserved in the volume root directory and cannot be used for files. These are $MFT, $MFTMirr, $LogFile, $Volume, $AttrDef, . (dot), $Bitmap, $Boot, $BadClus, $Secure, $Upcase, and $Extend.[3] (dot) and $Extend are both directories; the others are files. The NT kernel limits full paths to 32,767 UTF-16 code points. There are some additional restrictions on code points and file names.

这里面有一句:There are some additional restrictions on code points and file names,我们跟随链接 "Naming Files, Paths, and Namespaces"

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.

Windows API 里面定义了一个常量 MAX_PATH,这个常量的值是 260,不过常量值不一定是具体的长度,继续向下看,文档里面有一个例子

For example, the maximum path on drive D is "D:\some 256-character path string"

好吧,那就试试

E:\>md 1234567890123456789012345678901234567890123456789012345678901234567890123

45678901234567890123456789012345678901234567890123456789012345678901234567890123

45678901234567890123456789012345678901234567890123456789012345678901234567890123

4567890123456789012345

文件名或扩展名太长。

删除一个字符,再试,删除,再试,…… 最后终于可以了,目录长度 244,啊,你是 MSDN 请来的逗比吗?

不能着急,继续往下看

When using an API to create a directory, the specified path cannot be so long that you cannot append an 8.3 file name (that is, the directory name cannot exceed MAX_PATH minus 12).

留坑吧,一会儿继续填。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值