The only differences I can think of are all aesthetic.

E.g. When you have many files, it will be hard for the user to navigate to the desired file because it wouldn't be organised nicely like in a tree-like file system with directories.

Are there are functional differences?

A tree-like file system would be one where you can create sub-directories whereas a flat-file system is where there are no sub-directories, just one folder with all files inside it.

  • 1
    Can you describe what you call "traditional" and "flat", and give examples? – Volker Siegel Sep 26 '14 at 3:45
  • 1
    @VolkerSiegel Please see my edit – Ogen Sep 26 '14 at 3:47
  • 2
    I edited the title to make it more searchable, and replaced the term "traditional" by tree-like, it was confusing because flat filesystems are the more traditional, older ones actually. Feel free to revert if I changed too much. – Volker Siegel Sep 26 '14 at 10:42

Comparing filesystem structures

We want to compare filesystem structures looking for non-aesthetic differences.

We compare hierarchical filesystems with a tree structure of directories,
with flat filesystems that have only one place that contains all files, similar to a single directory with no subdirectories.

The two main types of differences are in CPU time, and in memory use.
Another type that could be relevant here is the complexity of implementation.

Performance of file access

The performance of listing directories depends on the file count of the directory.
Even in hierarchical filesystems, it can be a problem to list files in a directory to delete them, if they are many.

That all is not relevant for only thousands of files, but for hundredthousands in each of 100 directories, you better not put them all in a flat filesystem, or all in one directory.

The problem is that a directory listing is going through the whole list - because no tree is used inside the directory.
To find a file, about half of the file names must be read, on average.

For 1000000 files in a flat filesystem, that means we need to read 500000 names.

In a tree structure, we could use two levels of the tree by splitting the files into 1000 directories, with 1000 files each. To find one, we need to read 500 names on average on each level, 1000 in total.
We could als use three levels with 100 entries. We'd need to read 150 names on average.

With this example calculation, it's plausible that a tree structure can easily be much faster than the flat filesystem, like 2000 times as fast.

Multiple uses

Part of the tree in a hierarchical filesystem can be used for some separate purpose, while not using the rest for that purpose:
For example, you can mount another filesystem - flat or not - into a subdirectory of a hierarchical filesystem.
Mounting into the flat filesystem makes as little sense as mounting into the root of a hierarchical filesystem.


A tree-structured filesystem has subsections - the subdirectories - which you could assign permissions.
In a flat filesystem you can not make someone see only part of the file names.
To change permissions in a flat filesystem, for part of the files, is not possible all at once - it needs changes on each individual files permissions, and may take seconds or minutes while the permissions are unclear and changing.

Small and simple

Flat file systems can have advantages in ressource limited environments - in embedded systems.
A flat file system implementation can be very simple. And as long as the count of files to handle is small, it can even be faster than a hierachical filesystem!

A hardware device may need to store a list of files, each labeled with a number, and never more than 1000 at once. For this task, using a flat filesystem makes sense if it allows to use a smaller processor, resulting in longer battery life.

The simplicity of a flat filesystem can also be helpful to make sure the filesystem does not have bugs in the implementation.

| improve this answer | |
  • 1
    So why do flat file systems exist? Surely there must be some advantages. The only one I can think of is that flat file systems save memory because you don't need sub-directories. Is this true? – Ogen Sep 26 '14 at 3:58
  • 2
    I think it's long ago that everybody started to use tree filesystems? The first versions of CP/M or maybe DOS had a flat filesystem. – Volker Siegel Sep 26 '14 at 4:06
  • 2
    They have existed because they are much simpler, and save some memory. And because there was no need for handling many files - the computer could not handle them anyway. – Volker Siegel Sep 26 '14 at 4:08
  • 2
    Do you also think about flat filesystems used today for special cases? I think there are some pretty unusual structures in distributed filesystems. – Volker Siegel Sep 26 '14 at 4:10
  • 2
    I've heard that Cameras have flat file systems to store the images on them. – Ogen Sep 26 '14 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.