Sign in with
Sign up | Sign in
Your question

How to get list from a folder or drive in to a excel file through dir command in

Last response: in Storage
a b G Storage
February 26, 2010 12:26:49 AM

I have a with some file. So i'ld like to save file list by using dir cmd or any cmd to a excel file rather than type of that file name. can any one help for that.

More about : list folder drive excel file dir command

a c 362 G Storage
February 26, 2010 3:13:35 PM

Back to using DOS commands. The basics of this is simple. Go to a DOS prompt window. We're going to use the redirection operation (the ">" symbol) to put the output of the DIR command into a simple text file instead of onto the screen. The syntax is:

DIR >C:\(folder)\filename.txt

This will put the display of the Directory of the current folder into a new text file called "Filename.txt" located in the "(folder)" folder of the C: drive. for example, to make sure I remembered how to do this, I opened a DOS window and its prompt told me it was already in the C:\Documents and Settings\Paperdoc folder. When I typed:

DIR >C:\junk.txt

it created the junk.txt file in the root of the C: drive. When I opened it with a simple text editor like Notepad it looks exactly like the typical screen display of the plain DIR command with nothing after it. I could have specified a different folder to display by saying something like DIR C:\Program Files\Java\*.* > (etc). I could have let it place the junk.txt file in the current folder if I had NOT told it to put it in the C:\ (that is, the root) directory.

Once it is in that text file you can look at it with any text editor, of course. Or, you could import it into Excel using its file import tools and save that as a worksheet.