{"id":1163,"date":"2014-04-23T07:00:00","date_gmt":"2014-04-23T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2014\/04\/23\/how-do-i-programmatically-create-folders-like-my-pictures-if-they-were-manually-deleted\/"},"modified":"2014-04-23T07:00:00","modified_gmt":"2014-04-23T07:00:00","slug":"how-do-i-programmatically-create-folders-like-my-pictures-if-they-were-manually-deleted","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20140423-00\/?p=1163","title":{"rendered":"How do I programmatically create folders like My Pictures if they were manually deleted?"},"content":{"rendered":"<p>A corporate customer had a problem with their employees accidentally deleting folders like <i>Videos<\/i> and <i>Pictures<\/i> and are looking for a way to restore them, short of blowing away the entire user profile and starting over. They found some techniques on the Internet but they don&#8217;t always work consistently or completely. <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2014\/02\/06\/10496796.aspx#10497222\"> What is the recommended way of recreating these missing folders<\/a>?\n It turns out that the customer was asking a question that I answered <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2004\/11\/23\/268486.aspx\"> many years ago<\/a>, but looking at it from the other side.\n To recreate a folder, call <code>SHGet&shy;Folder&shy;Path<\/code> with the flag <code>CSIDL_FLAG_CREATE<\/code>, or call <code>SHGet&shy;Special&shy;Folder&shy;Path<\/code> and pass <code>fCreate = TRUE<\/code>.\n If you are targeting Windows Vista or higher, the known-folder equivalent is calling <code>SHGet&shy;Known&shy;Folder&shy;Path<\/code>, <code>SHGet&shy;Known&shy;Folder&shy;ID&shy;List<\/code>, or <code>SHGet&shy;Known&shy;Folder&shy;Item<\/code> with the <code>KF_FLAG_CREATE<\/code> flag.<\/p>\n<p> (There is a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb762494(VS.85).aspx\"> <code>CSIDL<\/code>-to-KF conversion table<\/a> in MSDN.) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A corporate customer had a problem with their employees accidentally deleting folders like Videos and Pictures and are looking for a way to restore them, short of blowing away the entire user profile and starting over. They found some techniques on the Internet but they don&#8217;t always work consistently or completely. What is the recommended [&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-1163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A corporate customer had a problem with their employees accidentally deleting folders like Videos and Pictures and are looking for a way to restore them, short of blowing away the entire user profile and starting over. They found some techniques on the Internet but they don&#8217;t always work consistently or completely. What is the recommended [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/1163","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=1163"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/1163\/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=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}