How can I produce a text list of the contens of a folder in Windows XP
November 2, 2007 6:52 AM   Subscribe

How can I copy a list of files in a folder on Windows XP, without using the print screen key/command?

I have a window open in Explorer on XP. This window has a list of files and folders in it. I want to copy that of files and folders into Word.

Print Screen WILL NOT work, as that just produces graphic files and the list of files is longer than the screen.

I tried selecting all and right clicking and choosing print, but that just wants to print the actual files, not the list. Doing a copy and attempting past into Word produces nothing except this error:
"Windows cannot obtain the data for the '(folder name)' link"

Searching help or Google produces nothing except the Print Screen button, which again, Print Screen WILL NOT work, as that just produces graphic files and the list of files is longer than the screen.
posted by Brandon Blatcher to Computers & Internet (14 answers total) 21 users marked this as a favorite
 
From a command prompt you can do a dir c:\directoryname\*.* /b.
posted by deadmessenger at 6:53 AM on November 2, 2007


Start > Run. Type 'cmd', hit enter. Type 'cd "path/to/folder"'. Type dir. Right-click, click Select All. Hold Ctrl-C. Paste into Word.
posted by Aloysius Bear at 6:56 AM on November 2, 2007


Go to the Start button and click on Run...

Type cmd

Hit Return

Navigate to the directory you want listing (e.g. e:\mystuff\)

Type dir /s e:\listing.txt
(where listing.txt is the name of the file that will be produced)

Copy the contents of listing.txt to a Word file and format as required.

The /s parameter is one of many you can use to modify the contents of the list but that should get you started.
posted by ceri richard at 6:56 AM on November 2, 2007


If you install the "Command Prompt Here" PowerToy, then just right click in the folder and "Open Command Window Here".

Then type:

dir /b

This will give you the list on the screen that you can copy and paste. Note that this works slightly differently in a command prompt window, but you should be able to figure it out.

Alternatively, run this command instead:

dir /b > C:\List.txt

This will give you a file called List on the root of your C: drive that you can open in Word or Notepad or whatever.
posted by jon4009 at 6:58 AM on November 2, 2007


"...that you can open in Word or Notepad or whatever."

Cool! I'd never thought to try opening the resulting .txt file straight in Word but I just tested and it works. Thanks jon4009.
posted by ceri richard at 7:01 AM on November 2, 2007


If you need a list that you can manipulate somehow, use a VBA routine:

Sub ListOfFiles()
Dim strPath As String
Dim strFile As String

strPath = "C:\DirectoryName\"
strFile = Dir(strPath)
Do
If strFile = "" Then Exit Do
With Selection
.TypeText strFile
.InsertParagraphAfter
.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdMove
.InsertParagraphAfter
End With
strFile = Dir
Loop
End Sub

Open a new document and run this code. It prints a list of the files on the new document.
posted by No Mutant Enemy at 7:04 AM on November 2, 2007


Best answer: I use a little program called Clipname for this. It's a perfect little utility that just adds an option to the right-click menu in Explorer, and gives you the option to get the filenames, or the pathnames, or whatever else you might need.
posted by smackfu at 7:34 AM on November 2, 2007 [1 favorite]


Response by poster: smackfu, you da man!
posted by Brandon Blatcher at 7:46 AM on November 2, 2007


Best answer: Opening the folder in Firefox will also allow you to copy the names of the files and folders and paste it into Word. It will also include the date created and size information, I'm not sure if you're looking for that too.

To do this:
1. Open the desired folder in Windows Explorer
2. Copy the address of the folder e.g. c:\folderwithfiles
3. Open Firefox
4. Paste into the address bar.
5. Highlight the text you want
6. Copy and paste
posted by Gomez_in_the_South at 7:50 AM on November 2, 2007 [6 favorites]


You can print directory listings from Outlook. You can browse My Computer from Outlook and then print the view you have within the Outlook pane. It allows you to customise the details shown too - in much the same way you use Explorer.
posted by sdevans at 8:25 AM on November 2, 2007


Response by poster: You can browse My Computer from Outlook

Please explain how to do this, as I don't see a Browse option or anything under View or File that would allow directly browsing. I'm using Outlook 2003.
posted by Brandon Blatcher at 8:38 AM on November 2, 2007


Like Brandon Blatcher I'd love to know the Outlook tip. Last reference I can find to this capability was Outlook 98. I did turn up an MS KB though: How to add the print directory feature for folders in Windows XP.
posted by cairnish at 9:09 AM on November 2, 2007


copy the following line into an empty text file:

dir %1 /s /b /l > %1\..\file_list.txt

and save the file as something like "makefilelist.bat" (it has to have a .bat extension)

then you can simply drag any folder onto it and it's going to save a text file with all the contents of that folder and subfolders (check with the dir command options for that) in the parent folder.

You can also save it into your "sendto" folder ( which is in c:\documents and settings\YOUR_USER_NAME\SendTo) and then just right-click on a folder, choose "Send To" and then "makefilelist.bat".
posted by _dario at 10:21 AM on November 2, 2007 [1 favorite]


To those who need to browse 'My Computer' from Outlook;

This is valid for Outlook 2002 (the most recent I have).

In the shortcut panel (Outlook Bar) down the side of Outlook, there is by default (I Think), Outlook Shortcuts, My Shortcuts and Other Shortcuts.

Within 'Other Shortcuts' there is 'My Computer', 'My Documents' and 'Favorites' you can move them around from there, but the functionality is built in.

After digging round a little, you can just drag a folder that you want a shortcut to into the Outlook Bar, and it's available. Just drag c: to it, or start further down the tree if you want.

BTW it won't display the folder tree, just the files and folders within a single folder.
posted by sdevans at 5:36 AM on November 5, 2007


« Older Jung: Gifted and Wack?   |   How Do I Grow a Fancy Indoor Lawn? Newer »
This thread is closed to new comments.