Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Save list of files as a text document or spreadsheet

Feb 7, 2005 11:15AM PST

I am trying to go into Windows Explorer or My Computer and save the contents of a folder--the actual file names--as a text file like a list. I don't care if the result is a Word .doc file or Excel .xls file, I just want my file names as text.

I don't want to open any of the files, only save the names in a document. Any suggestions?

Discussion is locked

- Collapse -
Have you considered Print Screen
Feb 7, 2005 1:01PM PST

These are the instructions for doing it on Windows XP as copy and pasted from the Help file
To copy the window or screen contents
To make a copy of the active window, press ALT+PRINT SCREEN.
To copy the entire screen as it appears on your monitor, press PRINT SCREEN.
Note

To paste the image into a document, click the Edit menu in the document window, and then click Paste.

- Collapse -
Yes, but...
Feb 7, 2005 5:28PM PST

This will insert an image file into Word, but I want actual editable text.

- Collapse -
Try using 'tree' in a batch file program...
Feb 8, 2005 12:58PM PST

treeDirTxt
A very simple batch file I wrote to do this, save the text below as a *.bat file. Place it in the directory you want to index, then run it. See notes below. It's not perfect, but it works. Probably a way to do this so you can just call it up on a right-click menu instead of copying/pasting to each directory...

tree /f /a >dir.txt


--Makes a complete index of all files in a "tree" structure. Place a copy of the batch file in the root directory that you want an index of, then run it. The result will be a file named dir.txt placed in that root directory. (or yourname.txt)

Don't forget to rename this file before running the program again! Also, check that there is not a file named dir.txt before running the program for the first time, if there is then edit the batch file or change the existing file name.

Hope you find this useful!
John

- Collapse -
SendToX
Feb 8, 2005 2:34AM PST

There is a useful PowerToy from Microsoft that, among other capabilities, can copy the filename(s) of the selected item in your Windows Explorer to the clipboard.

You should be able to find in as a PowerToy for Windows 95, but it also works for Windows XP. I use it.

Once installed you use it by opening the Windows Explorer, and select as many files as you want;
then right-click to the "Send To" menu;
then select "Clipboard as Name"

From there just go to any other editable file or document and paste (Ctrl-V) and you will see all the filenames entered for you.

There are other features within the PowerToy "SendToX" also.

- Collapse -
Might check this out..
Feb 8, 2005 4:27AM PST
- Collapse -
PrintFolder
Feb 8, 2005 11:56AM PST

Does this sound like its what you're looking for? Simple to use, and free for basic version.

PrintFolder ver. 1.2
---------------------------------
PrintFolder is a simple utility to print a list of files and folders,a feature missing in Windows Explorer.

Right-click on any folder in Windows Explorer and choose "PrintFolder" in the pop-up menu, or select a folder with the Browse for folder button.

Click the Options tab to set various program preferences, like maximum filename length, left margin, font size, invert text area colors and more.

PrintFolder is distributed as freeware.

If you want more features, like recursive listing of subfolders, configurable sort options, print preview and more, please take a look at PrintFolder Pro. You can download a FREE trial version
from website:

http://no-nonsense-software.com

- Collapse -
Tree or Dir
Feb 8, 2005 11:45PM PST

The programs recommended above are really cool - i just downloaded them.
But if in a real hurry, use the TREE command, or you can use the good ole DIR command. The one in win2k/xp has more features than the one in win98.

dir /b>contents.txt (bare names, no filesize, etc)

dir /b/s>contents.txt (as above, but with subfolders)

dir /b/s/ad>contents.txt (show only dirs)

dir /b/s/a-d>contents.txt (show only files)


[DOS command]>[filename] creates a new file from scratch & saves the output
[DOS command]>>[filename] appends output to an existing file

Also check out the SORT command (example: SORT contents.txt) and also the FOR...IN...DO command for batch files.