{"id":2318,"date":"2010-10-13T00:01:49","date_gmt":"2010-10-13T08:01:49","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=2318"},"modified":"2010-10-12T20:14:42","modified_gmt":"2010-10-13T04:14:42","slug":"printing-a-directory","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=2318","title":{"rendered":"Printing a Directory"},"content":{"rendered":"<p>There is no way in any graphical operating system I&#8217;ve ever used to print out a list of files in a folder. In the older days, at the command prompt, back when it was called a <em>directory<\/em> of files and not a folder, the command was simple. But not today!<br \/>\n<!--more--><br \/>\nI&#8217;m sure there are plenty of utilities out there that print a directory of files. I&#8217;ve not found any that I really like. Whatever.<\/p>\n<p>At the command prompt you can still print out a list of files, but you have to be sneaky to do it.<\/p>\n<p>In the old days, the following command would work:<\/p>\n<p><code>dir > prn<\/code><\/p>\n<p>PRN is the code name for the primary printer device in DOS. By typing <code>dir > prn<\/code> you redirect the output of the <code>dir<\/code> command, which lists files, to the printer. That command won&#8217;t work in current versions of Windows. (I&#8217;m not sure about Windows XP, though.)<\/p>\n<p>Even when <code>dir > prn<\/code> worked, you also had to send a form feed command to the printer to get the entire page to print. That command was <code>echo ^L > prn<\/code>, where the <code>^L<\/code> was the Ctrl+L key combination, which not only cleared the screen but ejected a piece of paper from a printer. (I don&#8217;t know if that command still works or not.)<\/p>\n<p>Anyway, it doesn&#8217;t work.<\/p>\n<p>What does work is the following three commands.<\/p>\n<p>First, you open a command prompt to the directory you want to print. Yeah, obviously, that takes a familiarity with DOS and its text-mode commands. I&#8217;ll assume you know where you&#8217;re going (though it&#8217;s possible that I may write a later blog post on how to get there). Once there, you type this command:<\/p>\n<p><code>dir > printdir<\/code><\/p>\n<p>That command takes the output of the <code>dir<\/code> command, which is a list of files, and sends that output to a text file named <code>printdir<\/code>.<\/p>\n<p>Second, you need to print the text file <code>printdir<\/code>. You can&#8217;t do that from the command prompt, so you have to cheat and run the Notepad program. That can still be done from the command prompt, by typing this command:<\/p>\n<p><code>notepad \/p printdir<\/code><\/p>\n<p>The above command runs the Windows Notepad text editor, loads the file names <code>printdir<\/code>, and prints the file. Then Notepad closes. Ta-da! You have a printed directory of files.<\/p>\n<p>It&#8217;s the <code>\/p<\/code> switch that causes Notepad to print the file and close. It&#8217;s true: Many of Windows GUI programs have command line options. Sneaky, that Microsoft.<\/p>\n<p>Finally, you need to remove the printdir text file, which has served its purpose:<\/p>\n<p><code>del printdir<\/code><\/p>\n<p>The <code>del<\/code> command deletes the file; there is no prompt or warning.<\/p>\n<p>Yes, this is technical. Yes, this is awkward. But as far as I know, it&#8217;s the only native way to print a list of files in Windows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is no way in any graphical operating system I&#8217;ve ever used to print out a list of files in a folder. In the older days, at the command prompt, back when it was called a directory of files and not a folder, the command was simple. But not today!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2318","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2318"}],"version-history":[{"count":5,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2318\/revisions"}],"predecessor-version":[{"id":2323,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2318\/revisions\/2323"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}