What is the difference between the Folder and Directory (and other special) progids?


When you're installing your shell extension, you need to know which progid to hang it off of inside HKEY_CLASSES_ROOT. We'll start with the title question and then move on to other predefined (but perhaps not well-known) progids.

  • "Folder" is the progid for any shell folder. It could be a virtual folder (like Control Panel) or a file system folder (like C:\WINDOWS).
  • "Directory" is the progid for file system folders. This is a subset of "Folder".
  • "*" is the progid for all files. Doesn't matter what the extension is.
  • "." (that's a single period) is the progid for files without any extension.
  • "AllFileSystemObjects" is the union of "*" and "Directory". It is the progid for all files and for file system directories.
Comments (23)
  1. Stupid person says:

    Err, so what is the difference between a folder and a directory?

  2. John says:

    Tom – why would you want something that applies to "all file system objects" to appear on virtual folders like Control Panel?

  3. Bahbar says:

    Stupid person – You want to reread the first bullet. No really.

    Here:"Folder" is the progid for any shell folder. It could be a virtual folder (like Control Panel) or a file system folder (like C:WINDOWS).

    Hint, it makes a distinction between 2 things. virtual folders and file system folders. You still do not see the difference ?

  4. Smart person says:

    Err, so what is the difference between a folder and a directory?

    Err, he just explained it.  Here, let me show you a picture:

    +——————————-+

    | – FOLDER –                    |

    | Control Panel                 |

    | My Computer                   |

    | My Network Places             |

    | and so forth                  |

    |                               |

    | +—————————+ |

    | | – DIRECTORY –             | |

    | | C:Documents and Settings | |

    | | C:Program Files          | |

    | | C:Windows                | |

    | | and so forth              | |

    | +—————————+ |

    |                               |

    +——————————-+

    Understand?

  5. Googol says:

    Then, why microsoft make Control Panel looks like a directory?

  6. Anonymous says:

    Googol: Microsoft made the Control Panel look like a directory for the same reason that everything is a file in UNIX;  it allows for uniform access.

    I could be wrong, this is a guess on my part, but from the developer’s perspective all of our compiled and scripted languages don’t have to support a new API, they can use existing, tried and true, file system API’s to access the Control Panel, or any other thing that has a directory/file interface.

  7. Mr Cranky says:

    I think this discussion would be clearer if "file system" was hyphenated (i.e. "file-system") as it probably should be when used as an adjectival phrase.  

    However, when reading an article about programming, it pays to read closely, Tom & Stupid Person.

  8. Bob says:

    Anonymous: Not so much. Yes, you can do stupid IShellWhateverInterface tricks to access the Control Panel the same way you could C:WINDOWSSYSTEM32SOL.EXE, but none of the "classical" filesystem APIs (fopen, std::ifstream, CreateFile) let you walk into virtual folders like Control Panel and My Computer by default.

    Unix does what it does because it makes the APIs identical for the programmer. Windows does what it does because it makes the GUIs identical for the user. There’s a difference.

  9. Daniel says:

    Off into grammar nitpick land we go, sorry…

    I think this discussion would be clearer if "file system" was hyphenated (i.e. "file-system") as it probably should be when used as an adjectival phrase.

    It shouldn’t be hypenated; it’s like "red house doors", not "high-flying airplanes."  Yes, it’s ambiguous – is the house red or are the doors?  Apparently, the language designers didn’t forsee the need for grouping operators. ;)

  10. hampsi@yahoo.com says:

    Is it correct to say that "folder" is a general term meaning an interface and container for a collection of objects whereas a "directory" is a physical container located on some storage medium? Thus all directories are folders but not all folders are directories. Some folders are interfaces generated in memory.

  11. KenW says:

    Mr Cranky: "However, when reading an article about programming, it pays to read closely, Tom & Stupid Person."

    Almost got it. Remove the word "closely" from what you posted, and add a couple of other words, and it’s right:

    "However, when reading an article about programming, it pays to actually read it, Tom & Stupid Person."

  12. Wolf Logan says:

    quartic — that’s essentially it. Folders belong to the Shell, Directories belong to the File System. The Shell treats Directories as a type of Folder, so you could say that Directories are Folders, but not all Folders are Directories.

    In Vista things get a little more complicated, with virtualisation adding Virtual Directories to the mix, but that’s not what Mr. Chen’s talking about here.

  13. Rick C says:

    quartic, regarding "red house doors," of course the language has constructs to remove that particular type of ambiguity, such as "doors on the red house" or "red doors on the house." :)

  14. Tom says:

    Sorry to be lazy and not look this up, but is AllFileSystemObjects really * and Directory and not * and Folder?  It seems odd that it would limit itself to just system folders…

  15. Tom says:

    @Mr Cranky

    For some reason my brain skipped over the first parenthetical, and when I read "file system" instead of "filesystem" or "file-system" the illusion was complete.  Thank you for your civility in response.

  16. Merus says:

    Aah, I was wondering why my little right-click item (internal only, thank god) was turning up on system folders. Thank’ee, Raymond.

  17. JamesNT says:

    Since Mr. Chen actually went through the trouble to make a post about this, I am left with one inevitable conclusion:

    I can’t believe he actually had to explain this.  And I’m being very serious.  I consider this one of the first things anyone making a shell extension must learn.

    JamesNT

  18. Pavel Lebedinsky says:

    This information can be useful for normal users as well, not just shell extension writers. For example, here’s how you can make files without extension to open in notepad when double-clicked:

    [HKEY_CLASSES_ROOT.shellopencommand]

    @="notepad %L"

  19. Stephen Jones says:

    file-system directories is the punctuation that Bill Walsh, head copy editor at the Washington Post would insist on.

    I would suggest there is not enough ambiguity to make it necessary; after all what on earth would a file system-directory (which is the only other alternative meaning) be.

  20. haven’t we forgotten HKEY_CLASSES_ROOTDrive?

    [I have yet to encounter anybody who was confused
    by that one. This is not “A complete list of all progids” just a selection of ones
    that are not well known/easily confused. -Raymond
    ]
  21. Quartic – "Folder" is the word a Shell developer uses when they mean "An implementation of IShellFolder."

  22. Mark H-A says:

    As a Mac and Windows user, I spent the last decade believing that "folder" and "directory" meant the same thing.

    Now I’ve read that not only is one a subset of the other, but that which way round they go depends on the platform!

    Mac: directory > folder

    Windows: folder > directory

    Why have we redefined these old terms to mean different things?

Comments are closed.