Not sure if this is the right forum for such a question, but hopefully someone has an answer or can direct me to the right place.

I have several folders on my hard drive with thousands of files within them. I would like to copy the names of these files into a text file (eventually take into Excel so that I may sort, categorize, etc). Is there a free utility that will allow me to do this?

My other thought is to do this within DOS, but I am unsure of what the commands would be.

TIA,
~Kar

Recommended Answers

All 6 Replies

In the command prompt (ie DOS), navigate to the directory in question and type:

dir > [filepath and filename]

.
EG, to output the contents of my C drive to c:\temp\test.txt, I go to the c:> prompt and type:

dir > c:\temp\test.txt

In the command prompt (ie DOS), navigate to the directory in question and type:

dir > [filepath and filename]

.
EG, to output the contents of my C drive to c:\temp\test.txt, I go to the c:> prompt and type:

dir > c:\temp\test.txt

so do I type "dir >" ? do I have to create that txt file first so the copy has somewhere to go?

The redirection operator ( the > symbol) creates the file specified after it. More info on Redirection and Pipes in DOS here.

I can't seem to "navigate" to the folder. It's the My Music folder within My Documents. When I go into the cmd screen, DOS is already prompting with: C:\Documents and Settings\Amy>

My folder path of which I want a list of the files is: C:\Documents and Settings\Amy\My Documents\My Music

Use the DOS commands 'cd' or 'chdir' to change the current directory.
Use "dir /x" to find the 8.3 format name of each folder/file first. It isn't necessary, but it is useful.

EG:

C:\Documents and Settings\Amy>dir /x
...[OTHER FOLDERS]
08/11/2006  04:49 PM    <DIR>          MYDOCU~1     My Documents
...[OTHER FOLDERS]
C:\Documents and Settings\Amy>cd mydocu~1

C:\Documents and Settings\Amy\mydocu~1>dir /x

And so on.

I have several folders on my hard drive with thousands of files within them.

In case you want to search the sub-dirs, you shoul use the /s switch with dir.
Example:

dir /b /s > database.txt
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.