Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Computers & InternetSoftware · 1 decade ago

How can I get the names of files within a folder and place them into a text file?

I am trying to list within a .doc file all files within a folder. There are a couple hundred files and would rather not type them all out. What would be the best way to obtain the file names within a text file?

I have tried copying and pasting the files into the document. That creates object with the file name. This would be perfect except it comes with an icon. I would just prefer the text. Is there any way to hide the icon - this could be a solution.

Thanks

Update:

Btw, I know I could print screen the files and place a .jpg instead of a string of text. However, I would prefer text. :?

Update 2:

Thanks. Is there any way to remove the extra detail DIR gives?

2 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    Open a command prompt (DOS Window).

    Enter the following command at the prompt:

    C:\dir > c:\temp\files.txt

    This will create a list of all the files in the directory you're currently in. I could change to that directory (cd dirname, where "dirname" is the name of the directory).

    This will drop a text file called files.txt in the c:\temp folder. You can then open it in Word, and edit it as you see fit.This is called piping, wen you send the output of a command to a file.

    You can also use the "tree" command to burrow into subdirectories. Also, do a "help dir" at the command prompt to see other options for the dir command.

  • jmorge
    Lv 6
    1 decade ago

    you can do this in dos mode (command prompt).

    steps:

    go to command prompt (on your start>run menu, type CMD

    navigate to the folder you want by using dos commands

    if you don't know how to do this here's some pointers

    type CD C:\ [hit enter] (cd is the "change directory" command)

    your prompt should now show C:\ (you're now at the root level of your C drive).

    now type CD C:\[folder where you want to go] (hit enter)

    for example if your files are in a folder called My Letters type

    CD C:\MY LETTERS

    your prompt will now show C:\MY LETTERS

    now, type :

    DIR > FILELIST.DOC

    (DIR is the directory list command)

    this will do a directory listing of all files in that directory and redirect the results into a text file called FILELIST.DOC.

    now just open this file in Word and edit as needed.

    you can also play around with the DIR command to sort them certain ways, show long file names, short file names,etc. To see your options type DIR /?

    for example to sort by name, do DIR /ON

    DIR /ON > FILELIST.DOC will redirect the results from the screen to the file filelist.doc

Still have questions? Get your answers by asking now.