What's the maxium number of files a Unix folder can hold?
I think it will be the same as the number of files.
Varies per file system, http://en.wikipedia.org/wiki/Comparison_of_file_systems
On all current Unix filesystems a directory can hold a practically unlimited number of files. Whereas "unlimited" is limited by diskspace and inodes - whatever runs out first.
With older file system designs (ext2, UFS, HFS+) things tend to get slow if you have many files in a directory. Usually things start getting painful around 10,000 files. With newer filesystems (ReiserFS, XFS, ZFS, UFS2) you can have millions of files in a directory without seeing general performance bottlenecks.
But having so many files in a directory is not well tested and there are lots of tools which fail that. For example, periodic system maintenance scripts may barf on it.
I happily used a directory with several million files on UFS2 and had seen no problems until I wanted to delete the directory - that took several DAYS.
I assume you are thinking of storing a lot of files in one place, no?
Most modern Unix files systems can put a lot of files in one directory, but operations like following paths, listing files, etc. involve a linear search through the list of files and get slow if the list grows too large.
I seem to recall hearing that a couple of thousand is too many for most practical uses. The typically solution is to break the grouping up. That is,
/some/path/to/dir/a/ /some/path/to/dir/b/ ... /some/path/to/dir/z/
and store your files in the appropriate sub-directory according to a hash of their
basename. Choose a convenient hash, the first character might do for simple cases.
From the comment you left, I think you don't really care about how many files/folders your FS can host.
You should probably consider using ModRewrite and rewriting site.com/username to site.com/?user= or something of the kind and store all your data in a database. Creating one folder per user is generally not necessary (and not a good idea).
That said, each filesystem has limits, and
df can tell you how many inodes are available on each partition of your system.