{"id":2047,"date":"2018-06-02T19:08:04","date_gmt":"2018-06-02T19:08:04","guid":{"rendered":"http:\/\/bluegalaxy.info\/codewalk\/?p=2047"},"modified":"2018-07-02T19:08:04","modified_gmt":"2018-07-03T00:08:04","slug":"windows-command-line-create-directory-listing","status":"publish","type":"post","link":"https:\/\/bluegalaxy.info\/codewalk\/2018\/06\/02\/windows-command-line-create-directory-listing\/","title":{"rendered":"Windows Command Line: How to create a directory listing"},"content":{"rendered":"<p>This article details how to create a plain text directory listing on Windows, using the Windows command prompt. To open a Windows command prompt in Windows 10, simply type &#8220;cmd&#8221; in the Windows search bar.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2049\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/windows-cmd.png\" alt=\"\" width=\"374\" height=\"674\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/windows-cmd.png 374w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/windows-cmd-166x300.png 166w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><\/p>\n<p>Once the Command Prompt is open, use the &#8216;cd&#8217; command to change to the directory you want to get a directory listing of. I like to first copy the target system path and then type cd, then space, then right click to paste the path. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">cd C:\\Users\\Chris\\Desktop\\Meteor\\meteor-list-app<\/pre>\n<p>Once you are at the correct system path, you can type &#8216;dir&#8217; in order to see a directory listing.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">C:\\Users\\Chris\\Desktop\\Meteor\\meteor-list-app&gt;dir<\/pre>\n<p>For example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2054\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/dir-cmd.png\" alt=\"\" width=\"623\" height=\"522\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/dir-cmd.png 623w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/dir-cmd-300x251.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/p>\n<p>Now to make a .txt directory listing, use the command <code class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">dir &gt; name_of_file.txt<\/code><\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">dir\u00a0&gt; meteor_dir.txt<\/pre>\n<p>This creates a &#8220;meteor_dir.txt&#8221; file inside the target directory. For example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2055\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-file.png\" alt=\"\" width=\"219\" height=\"348\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-file.png 219w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-file-189x300.png 189w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><\/p>\n<p>When opened, this directory listing looks just like what was shown in the cmd window:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2057\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-txt.png\" alt=\"\" width=\"499\" height=\"442\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-txt.png 499w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/meteor-dir-txt-300x266.png 300w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/p>\n<p>Note: Instead of just providing the name of the file as an argument, we could provide a full system path to some other location where we want to save the file. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">dir &gt; C:\\some\\folder\\name_of_file.txt<\/pre>\n<p>Alternatively, if we want a more thorough directory listing, we could use:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">dir \/S \/O:D &gt; meteor_dir2.txt<\/pre>\n<p>This will iterate through every sub-folder as well as give dates and times for every file, so the output will be much larger. For example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2059\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/ext-dir.png\" alt=\"\" width=\"585\" height=\"996\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/ext-dir.png 585w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/07\/ext-dir-176x300.png 176w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/p>\n<p>\/S means include all sub-folders<br \/>\n\/O:D means sort by date and time<\/p>\n<p>In summary:<br \/>\n1.\u00a0 cd to the folder you want to capture<br \/>\n2.\u00a0 type dir &gt;name_of_file.txt (or alternative command)<br \/>\n3.\u00a0 hit Enter<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article details how to create a plain text directory listing on Windows, using the Windows command prompt. To open a Windows command prompt in Windows 10, simply type &#8220;cmd&#8221; in the Windows search bar. Once the Command Prompt is open, use the &#8216;cd&#8217; command to change to the directory you want to get a &hellip; <a href=\"https:\/\/bluegalaxy.info\/codewalk\/2018\/06\/02\/windows-command-line-create-directory-listing\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Windows Command Line: How to create a directory listing<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78],"tags":[139],"class_list":["post-2047","post","type-post","status-publish","format-standard","hentry","category-technologies-and-tools","tag-cmd"],"_links":{"self":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/2047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/comments?post=2047"}],"version-history":[{"count":5,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/2047\/revisions"}],"predecessor-version":[{"id":2060,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/2047\/revisions\/2060"}],"wp:attachment":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/media?parent=2047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/categories?post=2047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/tags?post=2047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}