Display a Directory List Without Header or File Information

Posted On 2007-04-14 by FortyPoundHead
Keywords:
Tags: Tip Windows XP
Views: 3135


When writing a DOS batch file in Windows XP, have you ever needed to acquire the list of files in the current directory without all of the header information (volume name and serial number), footer information (number of files and/or directories, bytes used and free), or extra file information (date and time, file type, and file size)?

The /b parameter, when added to the dir command, displays a "bare" directory listing, only providing a list of files and/or directories with no extraneous information. The following command displays all files and subdirectories in the current directory:

dir /b

For just a list of files:

dir /b /a-d

For just a list of subdirectories:

dir /b /ad

Like many other DOS commands the results can be piped to an external file, if desired. For example:

dir /b /ad > list_of_directories.txt


About the Author

FortyPoundHead has posted a total of 1974 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.161.108.58

Before you can post, you need to prove you are human. If you log in, this test goes away.




Code Links