How To List All the Contents of a Windows Folder Into a Text File

Posted by KariVM Tuesday, March 23, 2010 10:47 PM
There's a happy list-maker inside all of us. You know which one. It's that little voice in your head that pushes you to make your weekly (or daily) to-do list. The one that finds pleasure even in the most mundane task of doing a grocery list. You can feel it doing little cartwheels of joy whenever you tick off an item from your task list.



Here's something to make your little list-critter a bit happier: apparently there's a nifty Windows command that you can use to create a list, in .txt format, of the contents of any Windows folder.
To do this:
  1. Open the Command Prompt - it's under the Accessories folder of the Program list if you're using XP, or just type Command Prompt in the Start menu search box if you're using Vista.
  2. In the Command Prompt window, type this command: dir *path of directory you want to list*>*path where you want to save the txt file*.txt

Of course, you don't copy the "" marks. And you supply what goes between the **, without the **.

For example: I'd like to make a list of the contents of the My Documents folder and save the .txt file in My Documents. To do this I'll type:
dir c:\Users\user\My Documents>c:\Users\user\My Documents\list.txt

Voila! List.txt appears in My Documents, with a list of all the contents of the My Documents folder.

If the folder you'd like to list has subfolders, and you'd like to list the contents of the subfolders as well, you'll need to include the /s switch after the dir command. In the case of the above example, I'll have to type:
dir /s c:\Users\user\My Documents>c:\Users\user\My Documents\list.txt

And list.txt just becomes a tad more longer.

This command comes very handy when you're backing up data on a CD or DVD and want to have a simple file to list the contents. Or when your list critter just gets the urge to list just about every folder in your drive...

The only downside to this method is that list.txt may appear a bit too cluttered - it lists not just the file name, but the date and time of the file as well. If anyone knows how to tweak this, please do leave a line in the comments section of this post.

Here list critter critter critter....

list bunny

==============================================================

Update: You can see this article posted on Helium! Please don't forget to rate!

0 Response to "How To List All the Contents of a Windows Folder Into a Text File"

Post a Comment