Getting a list of files for a directory

Ever had a folder full of files and needed a text listing of all those files? Here’s a quick n’ dirty way to do it.

image I have a whole folder full of new icons for the next version of SharePoint and need to check them into source control. The big pain here is that I’ll need to go into source control and type in each file name to unlock it for editing, copy in the new file, then type in each file name to check it in. If, however, I had a list of all the files I could make a quick batch file to do it for me.

  1. Open your command prompt (on Vista, type cmd then right-click and run as administrator)
  2. Change directories to where you need a listing
  3. On the command line type: dir /b > filename.txt

Windows will create a new text file named “filename.txt” (you can name it anything you like on the command line). One thing to note: your text file will be included in the list, you may want to remove that line before using it to do any bulk operations. Enjoy!

Edit: A good reference for directory listings:

Leave a Reply

Your email address will not be published. Required fields are marked *