{"id":15794,"date":"2020-05-11T08:50:58","date_gmt":"2020-05-11T08:50:58","guid":{"rendered":"https:\/\/www.top-password.com\/blog\/?p=15794"},"modified":"2020-05-11T08:50:58","modified_gmt":"2020-05-11T08:50:58","slug":"export-directory-structure-in-windows","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/export-directory-structure-in-windows\/","title":{"rendered":"How to Export a Directory Structure in Windows 10 \/ 8 \/ 7"},"content":{"rendered":"<p>How can I print the hierarchical structure of a particular directory so I can share it to other people? Printing a directory listing sounds so easy, but Windows doesn&#8217;t provide a straightforward way to do this. In this tutorial we&#8217;ll show you how to use Command Prompt or PowerShell to export a directory structure in Windows 10 \/ 8 \/ 7.<\/p>\n<p><strong>Method 1: Export Directory Structure Using Command Prompt<\/strong><\/p>\n<ol>\n<li>Press the Windows key + R to launch the Run box. Type <strong>cmd<\/strong> and hit Enter to <a href=\"https:\/\/www.top-password.com\/blog\/open-command-prompt-in-windows-10\/\">open Command Prompt<\/a>.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/05\/run-cmd.png\" alt=\"\" width=\"401\" height=\"207\" class=\"alignnone size-full wp-image-11405\" \/>\n<\/li>\n<li>You can run the &#8220;<strong>tree<\/strong>&#8221; command to export the directory tree of any folder to a text file. In our case, the &#8220;<em>d:\\demo<\/em>&#8221; is the folder we want to export the directory tree, and the result is saved in a plain text file (*.txt).\n<p><code>tree d:\\demo \/a \/f > d:\\list.txt<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-folder-structure-with-cmd.png\" alt=\"\" width=\"476\" height=\"144\" class=\"alignnone size-full wp-image-15798\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-folder-structure-with-cmd.png 476w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-folder-structure-with-cmd-300x91.png 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/>\n<\/li>\n<li>Open the text file using Notepad and the entire directory tree is listed inside, and you can print them out.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/hierarchical-directory-structure.png\" alt=\"\" width=\"516\" height=\"319\" class=\"alignnone size-full wp-image-15799\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/hierarchical-directory-structure.png 516w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/hierarchical-directory-structure-300x185.png 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/>\n<\/li>\n<\/ol>\n<p>If you look for a way to export the directory structure in .csv format so you can open it with Microsoft Excel, proceed to the next method.<\/p>\n<p><strong>Method 2: Export Directory Structure Using PowerShell<\/strong><\/p>\n<ol>\n<li>To get started, you need to <a href=\"https:\/\/www.top-password.com\/blog\/5-ways-to-run-powershell-as-administrator-in-windows-10\/\">open the Windows PowerShell window<\/a>. If you&#8217;re running Windows 10, press the Windows key + X together and select &#8220;<strong>Windows PowerShell<\/strong>&#8220;.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2018\/08\/open-powershell.png\" alt=\"\" width=\"315\" height=\"381\" class=\"alignnone size-full wp-image-12431\" \/>\n<\/li>\n<li>Enter the following command and press Enter. Make sure you replace &#8220;<em>d:\\demo<\/em>&#8221; with the folder which you want to export the directory structure.\n<p><code>Get-ChildItem -Recurse 'd:\\demo' | Select-Object FullName, name | Export-Csv -path d:\\list.csv -noTypeInfo<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-directory-tree-with-powershell.png\" alt=\"\" width=\"599\" height=\"169\" class=\"alignnone size-full wp-image-15800\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-directory-tree-with-powershell.png 599w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/export-directory-tree-with-powershell-300x85.png 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/>\n<\/li>\n<li>It will generate a .csv file which lists all files and sub-folders in your target directory. But it doesn&#8217;t show you the hierarchical levels like the Method 1 will.\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/exported-directory-structure.png\" alt=\"\" width=\"428\" height=\"182\" class=\"alignnone size-full wp-image-15801\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/exported-directory-structure.png 428w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2020\/05\/exported-directory-structure-300x128.png 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/>\n<\/li>\n<\/ol>\n<p>That&#8217;s it!<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How can I print the hierarchical structure of a particular directory so I can share it to other people? Printing a directory listing sounds so easy, but Windows doesn&#8217;t provide a straightforward way to do this. In this tutorial we&#8217;ll show you how to use Command Prompt or PowerShell to export a directory structure in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10,1894,3,39],"tags":[4456,4457],"class_list":["post-15794","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","category-windows-10","category-windows-7","category-windows-8","tag-export-directory-structure-windows","tag-export-folder-structure-to-excel"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=15794"}],"version-history":[{"count":6,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15794\/revisions"}],"predecessor-version":[{"id":15804,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/15794\/revisions\/15804"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=15794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=15794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=15794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}