Linux 在 Win7/Mac OS X/Ubuntu 文件系统上,单个文件夹中可以保存的最大文件数是多少?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7722130/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:36:29  来源:igfitidea点击:

What is the max number of files that can be kept in a single folder, on Win7/Mac OS X/Ubuntu Filesystems?

linuxmacoswindows-7ubuntufilesystems

提问by TCSGrad

I'm wondering about what is the maximum number of files that can be present in a single folder, in the file systems used by all the prevalent OSes mentioned. I need this information in order to decide the lowest common denominator, so that the folder I'm building can be opened and accessed in any OS.

我想知道在提到的所有流行操作系统使用的文件系统中,单个文件夹中可以存在的最大文件数是多少。我需要此信息来确定最小公分母,以便可以在任何操作系统中打开和访问我正在构建的文件夹。

采纳答案by ytg

In Windows (assuming NTFS): 4,294,967,295 files

在 Windows 中(假设 NTFS):4,294,967,295 个文件

In Linux (assuming ext4): also 4 billion files(but it can be less with some custom inode tables)

在 Linux 中(假设为 ext4):还有 40 亿个文件(但使用一些自定义 inode 表可能会更少)

In Mac OS X (assuming HFS): 2.1 billion

在 Mac OS X 中(假设 HFS):21 亿

But I have put around 65000 files into a single directory and I have to say just loading the file list can kill an average PC.

但是我已经把大约 65000 个文件放到了一个目录中,我不得不说仅仅加载文件列表就可以杀死一台普通的 PC。

回答by clrx

From what I know for Windows 7, you can have unlimited amount of files per directory. BUT the more files you have on a volume, the worse the performance will be for that volume.

根据我对 Windows 7 的了解,每个目录可以拥有无​​限数量的文件。但是一个卷上的文件越多,该卷的性能就越差。

回答by bdonlan

Most modern OSes have no upper limit, or a very high upper limit. However, performance usually begins to degrade when you have something on the order of 10,000 files; it's a good idea to break your directory into multiple subdirectories before this point.

大多数现代操作系统没有上限,或者有一个非常高的上限。但是,当您拥有 10,000 个文件时,性能通常会开始下降;在此之前,最好将您的目录分成多个子目录。

回答by DarkDust

This depends on the filesystem. The lowest common denominator is likely FAT32 which only allows 65,534 files in a directory.

这取决于文件系统。最小的公分母可能是 FAT32,它只允许一个目录中有 65,534 个文件。

These are the numbers I could find:

这些是我能找到的数字:

  • FAT16 (old format, can be ignored): 512
  • FAT32 (still used a lot, especially on external media): 65,534
  • NTFS: 4,294,967,295
  • ext2/ext3 (Linux): Depends on configuration at format time, up to 4,294,967,295
  • HFS+ (Mac): "up to 2.1 billion"
  • FAT16(旧格式,可以忽略):512
  • FAT32(仍然使用很多,尤其是在外部媒体上):65,534
  • NTFS:4,294,967,295
  • ext2/ext3 (Linux):取决于格式化时的配置,最多 4,294,967,295
  • HFS+ (Mac):“高达 21 亿”