How to create a list of filenames from a directory and send it to notepad to save or print

Free Computer Help By Mitz

Have you ever wanted to see a list of files or folders that are contained in a particular directory. I have. One day I decided that it would be great to have a list of the files from my music folder. But then I discovered that Windows does not have any tools to do this. So here is a fantastic, sneaky batch file that you can create to do the job for you. If you are not familiar with Batch files, you will be soon. Once you have made one, and see that it is successful, and working, they can become very addictive.

Please check out some very simple Batch Files before trying this one.

How to create a list of filenames from a directory and send it to notepad to save or print

  1. Paste this text below into notepad

@echo Dumping directory listing to c:dirListing.txt
@echo        (This may take some time for large directory trees.)
@REM the /A switch lists all hidden and system files as well.
@REM the /S switch lists all subdirectories and their contents.
@dir %1 /A /S > c:dirListing.txt
@echo Opening c:dirListing.txt in Notepad (Close notepad to delete file)
@notepad c:dirListing.txt
@echo Deleting c:dirListing.txt
@del c:dirListing.txt
@pause

  1. Name the file as Listdir.bat
  2. Save it in C :D ocuments and SettingsYour usernameSendTo. (see note)
  3. Now if you wanted to list the files in My music, right click on the folder
  4. Choose send to from the menu, then choose your file Listdir.bat
  5. Notepad will open with all the files in My music folder listed
  6. Now you can save or print this file.

To get this script to work on Windows Vista see this post on the forum A batch file to make a directory list for Windows Vista-

Notes:

  • The send to folder may be hidden by Windows. Here’s how to show hidden files.
  • Windows has no other way available to make a list of filenames that are in a directory or folder on your computer.
  • To print your list simply select print form the file menu at the top of notepad.

If you enjoyed this post please consider sharing ! :)



Subscribe in a reader

This post was written by...

– who has written 731 posts on Computer Tips.

Hi guys…I am a computer freak but I do not always talk in tech language. Hope you enjoy my website and learn everything you need to know in an easy to understand way.. If you like what you see please join: Follow Tips4pc On Twitter | Become A Facebook Fan | Subscribe RSS Feed | Tips4pc Youtube Channel

Contact the author

{ 3 comments… read them below or add one }

Wilson Tennis September 20, 2011 at 7:05 am

I want to thank you for this informative read, I actually appreciate sharing this good post. Maintain up your work.

Reply

Ed Murray March 20, 2011 at 7:41 pm

I tried running this in Windows 7 (had to change the target path for the dirlisting file because I got a message that c:\ was “Access Denied”). The batch file successfully created the listing in my alternate target folder, but with no results (just an empty, 0-byte file). I was trying to get a file listing from an external hard drive folder that was plugged in to my computer). Please help.
Thanks very much.

Reply

nithin February 18, 2011 at 4:29 pm

l tried the method but error occures saying a required privilege is not held by the client will u please say what is the requeired privilage

yours sincerely nithin

Reply

Leave a Comment

Please use your REAL NAME@KEYWORDS or just your REAL NAME to get approved. No links in the comment plz! Spam comments will be deleted so don't waste your time!

Previous post:

Next post: