Ask the Community
Groups
Recursive directory listing in Windows - Connect IT Community | Kaseya
<main> <article class="userContent"> <p><strong>QUESTION</strong>:</p> <p>How do I get a recursive directory listing?</p> <p><strong>SOLUTION:</strong></p> <p><strong>Reference</strong> - <a href="/home/leaving?allowTrusted=1&target=http%3A%2F%2Fsuperuser.com%2Fquestions%2F653860%2Flist-files-recursively-showing-only-full-path-and-file-size-from-windows-command">http://superuser.com/questions/653860/list-files-recursively-showing-only-full-path-and-file-size-from-windows-command</a></p> <p>A simple answer is:</p> <p>* Open a DOS command prompt using Run as Administrator</p> <p>* cd to the directory from where the listing should start </p> <div> <pre class="code codeBlock" spellcheck="false" tabindex="0"><strong>dir /b /s /a:-D > dirlisting.txt & more dirlisting.txt</strong> </pre> </div> <p>The output is redirected to the file dirlisting.txt and displayed on screen (Please delete file after use)<br><br><strong>Alternatively:</strong></p> <p>To retrieve the size as well<strong>:</strong></p> <p>A simple answer is:</p> <div> <pre class="code codeBlock" spellcheck="false" tabindex="0"><strong><a href="https://kaseya.vanillacommunities.com/profile/echo" rel="nofollow">@echo</a> 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</strong></pre> </div> <p>Note: You must type</p> <pre class="code codeBlock" spellcheck="false" tabindex="0"><strong>echo on</strong></pre> <p>to get the prompt back after the command above completes</p> </article> </main>