Copying a directory of file names to a Word document

Discussion in 'Off The Beaten Track' started by Jayar, Apr 6, 2011.

  1. Jayar

    Jayar Well-Known Member

    Joined:
    Dec 22, 2001
    Messages:
    8,609
    Hi everyone,

    I have been trying to copy a huge list of file names from a directory into a Word document, and I am having trouble (I am using WindowsXP 2002). I am going into the command prompt and typing DIR /B /O:N > filename.txt. When I do this, it tells me that it is unauthorized. I am trying to copy from a drive (X) and a folder named archive. Thoughts? There are THOUSANDS of files in there, and I don't want to have to copy and paste each one.

    Thanks!
     
  2. Aceon6

    Aceon6 Get off my lawn

    Joined:
    Dec 22, 2005
    Messages:
    6,071
    Have you tried the Print Directory feature in Windows? You can find the info at the Microsoft site.
     
  3. Artemis@BC

    Artemis@BC Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    4,953
    Are you trying to generate editable text? (i.e., a list of filenames that you can sort by name, date, etc.) Or is simply creating a "picture" of the filenames sufficient?

    If the former ... I'm not sure it's possible. I know I've tried to do that in the past and haven't found a way. But then I didn't spend that much time trying to figure it out.

    If the latter will do, it's much easier: simply do a screen print (PrtScn) of your directory display, one screen at a time, until you get them all.

    Of course if you upgraded to Win7 it's even easier -- Win7 comes with a fabulous little screenshot tool.
     
  4. Aceon6

    Aceon6 Get off my lawn

    Joined:
    Dec 22, 2005
    Messages:
    6,071
    Pretty sure Jayar needs the text, not an image. Again, Print Directory may be the only hope without some wizard scripting.
     
  5. FigureSpins

    FigureSpins New Member

    Joined:
    Jun 18, 2004
    Messages:
    2,062
    DOS to the rescue! Old reliable is the easiest solution.

    <start>
    <all programs>
    <accessories>
    <command prompt>

    You'll get a black DOS command prompt that says C:\ (current folder) >

    1) Change Directory (command = "CD") and type the drive specification and folder name
    Example: CD C:\Users\SAMPLEUSER\Foldername
    Press ENTER

    2) Get a Directory listing (command = "DIR")and send it to a file (output director = ">") called "filename.txt" in that same directory.
    Example: DIR *.* > filename.txt
    Press ENTER

    3) To exit the Command Prompt, type "EXIT" and press enter.

    4) Once you've created the file, find it with My Computer or Windows Explorer and open it with Notepad.

    5) Copy-and-paste the text into your Word document.

    For more info on streamlining the directory listing, open the command window and type "DIR /?" or "HELP DIR" and hit ENTER.
    It will list all of the options and switches. The switches can get rid of the headers, footers, sort the list, and all sorts of other clever tricks.

    If this is a process you have to do regularly, use NOTEPAD to create a command batch file.

    Just type the commands you would have typed in the window into the Notepad document and save it with an extension of ".bat" so that it becomes executable. Then you can just locate it in its folder and double-click. The commands will be run automatically and create or overlay the output file.


    ETA: Is this the "Print Directory" process mentioned earlier? Hmmm...never used it, but it looks complicated. Is there something more simple?
    http://support.microsoft.com/kb/321379
     
    Last edited: Apr 7, 2011
  6. Aussie Willy

    Aussie Willy Well-Known Member

    Joined:
    Feb 18, 2005
    Messages:
    18,051
    Figurespins - you almost make me want to use DOS. Almost.

    I might try this later.