Computing.Net > Forums > Disk Operating System > Dir list of files only,no subfolder

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Dir list of files only,no subfolder

Reply to Message Icon

Name: fheartman
Date: March 25, 2005 at 08:47:52 Pacific
OS: Win 2000 pro
CPU/Ram: 2.4g 1g
Comment:

Hoe can I get a list of files only that are in a specified directory. I do not want the names of the sub folders displayed. Now I am using dir /b i:\testfolder\
Inside of the test folders are files and sub folders. I only want dir to return the list of files.



Sponsored Link
Ads by Google

Response Number 1
Name: fheartman
Date: March 25, 2005 at 09:06:53 Pacific
Reply:

Never mind, I figured it out:
dir /a:-d /b i:\testfolder\


0

Response Number 2
Name: JackG
Date: March 25, 2005 at 09:07:39 Pacific
Reply:

The DOS DIR command was not originally designed to do something link that. But in later versions, the ability to do that was added. Quite simple and obvious if you just bother to look at at the DIR command syntax. DIR /?

The exact command depends on what you want.

If you want all files including the hidden files to be listed, but not the folders do:

DIR /a-d

If you only want the files a plain DIR commond would list and not the folders, use:

DIR /a-d-h

Keep in mind, this will not work on the oldest versons of DOS.


0

Response Number 3
Name: Mechanix2Go
Date: March 25, 2005 at 09:19:29 Pacific
Reply:

I don't know if this syntax will work on ANY version of DOS:

dir /ax

where x is the attrubute

This syntax:

dir /a:-d

will work in w2k but the colon is unnecessary.

***

Turning our attention once again to DOS.

The usual gambit is to whack out the unwanted stuff using find /v



M2

If at first you don't succeed, you're about average.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Dir list of files only,no subfolder

Batch: Make list of files on one line www.computing.net/answers/dos/batch-make-list-of-files-on-one-line/10526.html

List of files www.computing.net/answers/dos/list-of-files/12204.html

DOS Batch file www.computing.net/answers/dos/dos-batch-file/13817.html