Any limitation for having many files in a directory in Mac OS X?

Short Answer: Well, if you're reading 100,000 files, I might expect the script to be slow.

Long Answer: To answer this question more thoroughly, you have to look at the file system on a Mac. Macs use the HFS+ (Hierarchical File System Plus), which is a modern file system that has limitations, but only in extreme situations.

From my experience, it’s a lot like a Linux EXT journaling file system. It supports mounting directories, UNIX-like permissions, etc. It addressed files in a 32-bit format, making the maximum number of files that can be stored in a volume 4,294,967,295, according to this source.

The file system starts to break with files bigger than 8 EB on modern systems and up to 2.1 billion files and folders in one location as outlined here.

Given the way the HFS+—or really any file system is setup for that matter—having a lot of files in a folder should not do anything 'weird'.

Honestly, I don’t think there would be a performance improvement distributing the files across a more complex folder hierarchy. Actually, this technique might be less efficient because your script would have to make calls to change directories mid-process.