Recursive directory listing in Windows

QUESTION:

How do I get a recursive directory listing?

SOLUTION:

Reference - http://superuser.com/questions/653860/list-files-recursively-showing-only-full-path-and-file-size-from-windows-command

A simple answer is:

* Open a DOS command prompt using Run as Administrator

* cd to the directory from where the listing should start 

dir /b /s /a:-D > dirlisting.txt & more dirlisting.txt

The output is redirected to the file dirlisting.txt and displayed on screen (Please delete file after use)

Alternatively:

To retrieve the size as well:

A simple answer is:

@echo Results on %DATE% for %CD% >> dirlisting2.txt & echo off & for /f "delims=*" %A in ('dir /s /b /a:-d') do echo %~fA %~zA >> dirlisting2.txt

Note: You must type

echo on

to get the prompt back after the command above completes

Have more questions?

Contact us

Was this article helpful?
0 out of 0 found this helpful

Provide feedback for the Documentation team!

Browse this section