{"id":23423,"date":"2008-02-18T10:00:00","date_gmt":"2008-02-18T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/02\/18\/why-does-explorer-show-a-sign-even-if-there-are-no-child-folders\/"},"modified":"2008-02-18T10:00:00","modified_gmt":"2008-02-18T10:00:00","slug":"why-does-explorer-show-a-sign-even-if-there-are-no-child-folders","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080218-00\/?p=23423","title":{"rendered":"Why does Explorer show a + sign even if there are no child folders?"},"content":{"rendered":"<p><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#471136\"> Mike Williams asked in the Suggestion Box why Explorer shows a + sign next to a folder even though it doesn&#8217;t have any children<\/a>. Mind you, this wasn&#8217;t a suggestion; it was just a random question. I don&#8217;t enjoy answering random questions about specific details of user interface elements since, as it turns out, I did not write every single user interface element in the system, nor did I attend all of the design meetings.\n Some people are under the impression that as a senior developer that works with the user interface, I naturally attend every single user interface design meeting, even meetings to discuss things that I am not responsible for. I don&#8217;t know when these people expect me to get my work done or why I would enjoy going to hundreds of meetings that have nothing to do with my job. These people probably expect a senior electrical engineer at Boeing to attend all meetings on each of the 777&#8217;s electrical systems, even if her responsibility is just the entertainment system.\n Another reason I don&#8217;t enjoy answering these questions is that the person who asks the question is unlikely to be interested in the answer, since the answer is usually boring and technical.\n Anyway, I don&#8217;t know the answer, but I&#8217;m going to guess. (Actually, that sentence applies to most of what I write. I just guess with confidence.)\n Recall that Explorer is a view onto the shell namespace, and that each item in the shell namespace has attributes. The attribute that is important here is <code>SFGAO_HASSUBFOLDER<\/code>, which indicates that the item is a folder that <i>might<\/i> have sub-folders. This is a strange backwards-like flag, since it is the absence of the flag that provides definite information. If <code>SFGAO_HASSUBFOLDER<\/code> is not set, then the shell namespace extension is promising that the folder has no sub-folders. If the flag is set, then the folder might have sub-folders, or it might not; no promises. Explorer uses this flag to determine whether to show a plus-sign next to an item in the Explorer folder view. If the flag is set, then a plus sign appears.\n Yes, this means that the plus sign appears even if there are no sub-folders, but it&#8217;s better than showing no plus sign when there <i>are<\/i> sub-folders. When you click the plus sign, Explorer goes looking for sub-folders, and if it ultimately finds none, then the plus sign disappears.\n Why not require that the flag be definite? In other words, why not say that <code>SFGAO_HASSUBFOLDER<\/code> guarantees the presence of a sub-folder, rather than merely hinting at the possibility of a sub-folder?\n Performance.\n Determining whether a folder has a sub-folder can be very expensive. For example, if the folder is a directory on a server halfway around the world, hunting for a sub-folder requires enumerating the contents of the directory looking for anything that&#8217;s a sub-directory. (Yes, you could try using the <code>FindExSearchLimitToDirectories<\/code> information level, but there is no guarantee that the server halfway around the world supports it.) This is quite an expensive undertaking just to decide whether to show a plus sign, and corporate administrators might not look too fondly on the &#8220;unnecessary&#8221; network traffic generated by all this probing.\n What&#8217;s more, determining whether there is a sub-folder may require additional user interaction. For example, the folder might be on a password-protected FTP server. It would not be a very good design to prompt the user to log in to an FTP server just so Explorer could decide whether or not to show a plus sign next to the server&#8217;s icon in the folder tree.\n I believe that Windows Vista sheds a much more skeptical eye on the <code>SFGAO_HASSUBFOLDER<\/code> flag. In part because some shell namespace extensions mis-manage the flag (forgetting to set it when they should) and because some users get upset by the &#8220;plus sign that doesn&#8217;t do anything&#8221;, Explorer&#8217;s kicks off a background thread to verify the plus-sign status of each item in the folder tree, or at least verify what it can without causing network administrators grief or disturbing the user. (Users wouldn&#8217;t like it if you, say, spun up the CD-ROM drive just to check whether or not to show that plus sign.) If you watch carefully, you might see a tiny magnifying glass overlay placed atop the folder icon while this background verification takes place.<\/p>\n<p> The remaining questions in that same comment are even less interesting. Clicking the plus sign will make it go away once Explorer has confirmed that there are no sub-folders after all. Perhaps the namespace extension is slow to enumerate sub-folders? And as for the cancellation of renaming: I don&#8217;t see this behavior. When a file copy completes in the background, I can still rename whatever I was renaming. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mike Williams asked in the Suggestion Box why Explorer shows a + sign next to a folder even though it doesn&#8217;t have any children. Mind you, this wasn&#8217;t a suggestion; it was just a random question. I don&#8217;t enjoy answering random questions about specific details of user interface elements since, as it turns out, I [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-23423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Mike Williams asked in the Suggestion Box why Explorer shows a + sign next to a folder even though it doesn&#8217;t have any children. Mind you, this wasn&#8217;t a suggestion; it was just a random question. I don&#8217;t enjoy answering random questions about specific details of user interface elements since, as it turns out, I [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/23423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=23423"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/23423\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=23423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=23423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=23423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}