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

Date:August 2, 2007 / year-entry #282
Tags:code
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20070802-00/?p=25743
Comments:    23
Summary: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...

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.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index