954,301 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Copying a folder into Excel or text file

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

karatelovr
Light Poster
49 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

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
DavidRyan
Posting Whiz in Training
229 posts since Jul 2006
Reputation Points: 22
Solved Threads: 11
 

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?

karatelovr
Light Poster
49 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

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

DavidRyan
Posting Whiz in Training
229 posts since Jul 2006
Reputation Points: 22
Solved Threads: 11
 

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

karatelovr
Light Poster
49 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

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
...&#91;OTHER FOLDERS&#93;
C:\Documents and Settings\Amy>cd mydocu~1

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


And so on.

DavidRyan
Posting Whiz in Training
229 posts since Jul 2006
Reputation Points: 22
Solved Threads: 11
 
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
Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You