Generating Folder and File Listingsfor Printing or Editing
Longtime PC users and former Mac users alike are often shocked when they realize that there’s no easy, built-in option to print a list of files in a folder. This hack creates a context-menu right-click option to create such a list, which you can then edit, copy, paste, and—most usefully—print.
How many times have you been browsing through directories in Windows Explorer and wished you could generate a text file or printout listing the files and folders? It seems like such a simple request that it’s amazing the option isn’t available. You don’t believe me? Right-click on a folder and see for yourself if there is an option to list or print the structure. There isn’t, but there is a workaround that doesn’t require any third-party software. Here’s how to create a context menu item [Hack #29] that, when clicked, generates a printable (and editable) text-file listing of the selected directory.
To create the entry in the context menu it’s
necessary to first create a
batch file. A
batch file is a text file that contains a sequence of commands for a
computer operating system and uses the .bat
extension. The format for the .bat file is:
dir /a /-p /o:gen >filelisting.txt
The name of the .txt file can be whatever you
like. In this example, I’ve used
filelisting.txt, but it could just as easily be
filelist, listoffiles,
namedfiles, or even Wally
if you enjoy the bizarre in your filenaming schemes. Once you’ve decided on the filename, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access