Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To print a folder’s contents in Windows 10 or 11, open that folder in File Explorer, type cmd in the address bar, press Enter, then run dir /b > filelist.txt. Open the resulting text file and print it. Use dir > filelist.txt instead if you want dates, sizes, and directory details.

Choose the kind of list you need

Windows’ built-in dir command can save a directory listing to a text file. Choose a command based on how much detail and how much of the folder tree you want to capture.

What you want Command What it includes
Names in the current folder dir /b > filelist.txt A bare listing without extra details.
A detailed listing of the current folder dir > filelist.txt Names, modification date and time, file sizes, and directory information.
Bare paths from the folder and its subfolders dir /s /b > filelist.txt A recursive listing with full paths and no additional listing details.
A tree view that includes filenames tree /f /a > filelist.txt A text-based folder structure with filenames.

Microsoft documents dir and tree for Windows 10 and Windows 11. See the DIR command reference and the TREE command reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Print a list from File Explorer

  1. In File Explorer, open the folder you want to list.
  2. Select the address bar, type cmd, and press Enter. Command Prompt opens at that folder.
  3. Enter the command that matches your preferred output. For a names-only listing, use dir /b > filelist.txt.
  4. Press Enter. The command writes filelist.txt to the current folder.
  5. Open filelist.txt in Notepad or another text editor, then use that application’s print command.

The File Explorer address-bar shortcut is a practical navigation method shown in Microsoft Q&A community answers; it is not the focus of Microsoft’s command-reference pages. If typing cmd there does not open Command Prompt on your setup, open Command Prompt another way and change to the target folder before running the listing command.

#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Adjust the listing’s scope and contents

Include subfolders

Add /s to dir to include subdirectories. For a compact recursive listing, use dir /s /b > filelist.txt. Without /s, the command lists only the current folder.

Include hidden and system items

By default, dir excludes hidden and system files. Add /a to include them: dir /a /b > filelist.txt. The bare output remains names-only; use dir /a > filelist.txt for the detailed form.

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Sort the results

Use /o:n to sort by name or /o:d to sort by date and time, oldest first. Prefix a sort option with a minus sign to reverse its order. For example, dir /o:-d > filelist.txt sorts by date and time in reverse order.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a tree view for folder structure

Run tree /f /a > filelist.txt to save a text-based tree that includes files. The /f option adds filenames, and /a uses text characters for the branch lines. With no path specified, tree starts from the current directory. For a flat list of paths instead, use dir /s /b.

Rank #3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Keep the output file out of the listing

If you save filelist.txt in the folder being listed, the output file may appear in the listing, depending on when and how the command generates it. To keep it separate, write the output to the temporary folder instead: dir /b > "%TEMP%filelist.txt". Then open the file at %TEMP%filelist.txt.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use PowerShell when you need scripting

PowerShell’s Get-ChildItem enumerates items in a location. Add -Recurse to include items in child containers; use -Depth when you want to limit traversal depth. For example, this saves a recursive listing to the temporary folder:

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
Get-ChildItem -Path 'C:pathtofolder' -Recurse | Out-File -FilePath "$env:TEMPfilelist.txt"

Replace C:pathtofolder with the actual folder path. This basic pipeline is useful for PowerShell-based enumeration, but its output is not necessarily a polished, stable column layout for printing. For a straightforward printable listing, the Command Prompt commands above give you more direct control over whether the output is bare, detailed, recursive, or tree-shaped. Microsoft documents the cmdlet’s enumeration and recursion options in the Get-ChildItem reference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
FAST PRINT SPEEDS: Print up to 19 pages per minute.; PAPER CAPACITY: Up to 150 sheets.; SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
$134.99
Bestseller No. 5
HP LaserJet M110w | Monochrome | Laser Printer
HP LaserJet M110w | Monochrome | Laser Printer
WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere; FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
Best Value
HP LaserJet M110w | Monochrome | Laser Printer
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.