Creating a Text File of Directory Structure and Filepath

Posted on 2012-09-21
Last Modified: 2012-09-21
Is there a way to generate a list of files and folders in a directory and have them output to a text file?  I need to traverse all files and folders in this directory and if possible in the file have a delimiter.
Question by:lm1189
    LVL 51

    Accepted Solution

    Sure, just do the following at a command prompt:

    dir /b /s "c:\yourfolder\*.*" >results.txt

    LVL 7

    Expert Comment

    All files (recursively) in a list:
    dir /b/s

    If you just want the folders
    dir /b/s/ad

    If you want the result in a text file, use the pipe:
    dir /b /s > textfile.txt
    LVL 14

    Expert Comment

    dir /b >> list.txt 

    Open in new window

    will create a simple text file with file and folder names.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
    Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now