5

I think there used to be a command called

dir -a

or something like that.

Now it's no longer there isn't it?

To see hidden file we need

dir /a:h

which will show only hidden files, which is not what I want.

So how to display all files, whether hidden or not?

  • dir /? will help you here... – PhonicUK Sep 5 '12 at 9:23
  • 1
    I did. No such option to search all. – user4951 Sep 5 '12 at 9:25
  • You didn't read to well then. You can use /s to recursively look in directories to find all files, and /a on its own to not care about attributes. – PhonicUK Sep 5 '12 at 9:30
  • 2
    @PhonicUK: I respectfully disagree, there is no mention of the behaviour of /a alone in the help I get with /?. I read it a couple of times to be sure. – m4573r Sep 5 '12 at 10:05
  • Okay which one is correct here? Anyone tested this? – user4951 Sep 11 '12 at 10:20
0

Just list all attributes in /a. That'd be dir /a:drhsa on real DOS and a few more letters on Windows with NTFS, all listed under /a in help.

  • What few letters? Why not listed some of the uses? How about fully explain what dir /a:drhas actually does? – Ramhound Sep 5 '12 at 12:28
  • @Ramhound, show me "Windows" in question and I think about explicitly mentioning them. "d, r, h, s, a", if it is not plainly obvious to somebody, are "all attributes", mentioned in previous sentence. Also, what additional uses except requested, quoting: all files, you propose to me to list? – Oleg V. Volkov Sep 5 '12 at 13:23
12

dir /a lists everything, visible and hidden files altogether.

  • Does it still work? I don't see that in the documentation. – user4951 Sep 11 '12 at 9:20
  • 1
    Yeah, as I said in my comment above, it's not in the /? anymore. However I tried it before posting. – m4573r Sep 11 '12 at 9:27
  • 1
    I think this should be selected based on large number of votes. I still do not know why this answer is better than the rest. Can anyone explain? – user4951 Mar 11 '13 at 6:49
  • 1
    @JimThio, this is the correct answer, and the answer provided by Oleg is wrong. dir lists only files and directories that have every attribute in the /a: set. So use the empty set, i.e. just /a. – eryksun Aug 28 '15 at 5:54
1

Depend on the environment, dir /a may work.

In other systems, dir /A: may be needed. That is, put a colon after the /A

This answer might apply to JP Software's 4DOS, as well.

Another option is to not use DIR, but to use the ATTRIB command. You're probably familiar with that command for changing file attributes. However, it can also be useful for simply showing files.

0

The undocumented "dir," (dir followed by a comma, no space) will show all files, including both hidden and system files. Not deleted files thou, use undelete to show those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.