Question: its more to a architecture related question, sorry if i ask in the wrong stack.

do they put them in a large pile im a folder ?
like

> 
> $uid.$md5(random).$name save in one
>  folder
> 
> 
> 

```
folder/5231.124wdadace123214.arandomname.jpg
folder/42.15125dawdaowdaw232.arandom2name.png
folder/etc

```

or

> 
> $uid/$md5(random).$name
> 
> 
> 

```
5231(uid)/12421adwawda2321.arandomname.jpg
42/15125awdawdwadwa232.arandom2name.png
etc/2323awdwadwadaw.logo.png

```

what im thinking here is the second one is better?  

**because at windows i have a lot of pics in one folder**  

and yes it takes time to open it.

do you guys have any idea how they keep the files ?

Answer: 
This depends mainly on the filesystem. For a modern filesystem like NTFS or ext3, keeping huge numbers of files in the same directory is not a problem, but some older filesystems could not handle it.

However, it may still be a good idea to partition the files into subdirectories according to some scheme, just to keep them manageable with various tools (which may have their own issues with humongous directories) such as backup. BTW, opening a directory in Windows explorer counts as such a case.
it depends how many images you're expecting to have if we're talking about thousand keeping the pictures in diffrent folders make's it easier for the computer to scan the directory for the file