3 Ways To Easily Print Out The Contents Of A Directory Or Folder [Mac]
Say you want to get a list of all the files contained in a certain folder. How do you go about it? The most straightforward way might be to jot down those names in TextEdit, and if we’re talking about 4 or 5 files it might even be the fastest way. Not so when you’re looking at hundreds or thousands of files, or if this task is a recurring one. In that case, we use our computer to solve this for us.
You’ve likely heard about one of these techniques before, but there are in fact a number of different ways to go about printing the contents of a directory. Below, we will take a look at three of these. Choose the one that fits your particular style or needs.
1. Drag & Drop To Your Printer
We’ll start off with the simplest tool of the bunch – your printer. Yes, you heard that right, and no, printer is not a metaphor for anything besides a printer.
When you connect a printer to your Mac computer, a printer-specific shortcut will be created. This may already be on your desktop, but you can usually find these in ~/Library/Printers, where ~ is your user folder. Use Finder’s Go -> Go to Folder… to bypass the hidden folders and go there easily.
So what complicated technical wizardry begets a list of your folder’s contents? Simple; you drag and drop the folder onto one of these printer icons, which gets you a list with filenames, file sizes and creation dates. A print window will pop up, which you can use to actually print the file list, or save it to your computer using the PDF button in the bottom left corner.
You may not always have your printer icon at hand, but if you do, this is one of the most effortless ways to generate a list of your folder’s contents.
2. Use The Terminal’s ‘ls’ Function
The most popular way to print file lists is undoubtedly with the Terminal, which you can find in Applications -> Utilities. As you can see in the screenshot below, typing ‘ls’ followed by a folder path generates a list of that folder’s contest. By using ‘ls FOLDER_PATH > OUTPUT_PATH‘, you can print this list to a text file on your computer.
You can use flags to customize this output; expand upon it. For example, using ‘ls –l‘ instead of just ‘ls‘ will print a detailed list, rather than just the filenames. Similarly, -h will force readable file sizes like KB and MB, rather than just byte sizes, and -R will recursively print the files embedded in folders, rather than just the folder names. Lookfor a full list of available flags.
Tip: You can drag and drop a folder onto the Terminal window to avoid having to type the path name. This will insert the full path name on the location of your cursor.
3. Use a Third-Party Application Like PrintWindow
Above, we saw two simple ways to print a folder’s contents to a file. But what if you need more control over your output? That’s the point to start looking towards third-party applications. One of the most popular of those applications (with reason) is printWindow.
printWindow gives you the easy graphical user interface and customization that the above two options are missing. The applications comes in a free and premium version. Luckily, the most important features are available in both flavors of printWindow.
What tricks do you use on your Mac to print out lists of folder contents? Let’s hear about them in the comments!
Image Credit: sheelamohan / Free Digital Photos