File Management
dirDIR Attributes (/A) Explained for Windows CMD
Learn how DIR /A works in Windows Command Prompt, including hidden, system, read-only, and directory filters with practical command examples.
In DIR, the /A switch means attribute filtering. It lets you list files and folders based on attributes like hidden (H), system (S), read-only (R), and directory (D). This is essential when default listings do not show what you expect.
What Does /A Mean in DIR?
/A tells DIR to filter output by attributes. You can include one or more attribute letters, and you can negate with -.
Syntax
DIR /A[:attributes]
| Attribute | Meaning | Example |
|---|---|---|
H | Hidden | DIR /A:H |
S | System | DIR /A:S |
R | Read-only | DIR /A:R |
D | Directories | DIR /A:D |
-D | Not directories (files only) | DIR /A:-D |
Examples
DIR /A
DIR /A:H
DIR /A:HS
DIR /A:D
DIR /A:-D
DIR /A:H /O:S
Common Use Cases
- Display hidden files in user profiles.
- List only directories for structure audits.
- Isolate read-only files before bulk edits.
- Review system files during troubleshooting.
Tips and Best Practices
- Use
/Awith/Ofor focused and sorted output. - Use
/A:-Dwhen file-only results matter. - Combine with
/Sto scan entire trees.
Troubleshooting Common Issues
Missing hidden files
Use /A:H or /A.
Unexpected directories in output
Switch to /A:-D.
Too broad results
Add file pattern filters.
Access denied on system paths
Run elevated CMD.
Related Commands
Frequently Asked Questions
What does DIR /A show?
All entries including hidden/system items.
How do I show hidden files only?
Use DIR /A:H.
How do I list only folders?
Use DIR /A:D.
How do I list files only?
Use DIR /A:-D.
Can I combine attributes?
Yes, e.g., DIR /A:HS.
Can I sort while filtering attributes?
Yes, e.g., DIR /A:H /O:S.
Does this work recursively?
Yes, add /S.
Is this available in all Windows versions?
Yes, DIR /A is widely supported.
Quick Reference Card
| Command | Purpose |
|---|---|
DIR /A | All attributes |
DIR /A:H | Hidden entries |
DIR /A:S | System entries |
DIR /A:D | Directories only |
DIR /A:-D | Files only |