Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 797
TCSGrad Avatar asked Oct 11 '11 06:10

TCSGrad


3 Answers

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

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

In Mac OS X (assuming HFS): 2.1 billion

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.

like image 70
ytg Avatar answered Oct 31 '22 12:10

ytg


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

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"
like image 31
DarkDust Avatar answered Oct 31 '22 11:10

DarkDust


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.

like image 3
bdonlan Avatar answered Oct 31 '22 11:10

bdonlan