Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get a list of files from a directory excluding files in hidden folders. With the following command, hidden folders are traversed even though I've set /A:-H to exclude hidden directories. Is there a different switch to stop them from being traversed too?

dir "C:\SVN" /A:-H /w /b /s

Alternatively, for this use case I know the name of the hidden folders I want to exclude, so if there is a way to exclude the folders by name ("\.svn\") that might have to suffice.


share|improve this question
up vote 1 down vote accepted

The /a:-h switch only applies to specific items that are marked hidden, it doesn't check the attributes of any ancestors. That is, files within a hidden folder also have to be marked as hidden themselves, otherwise dir will list them. To make this work you'll need to mark all of the subitems in your .svn folder as hidden.

share|improve this answer
dir c:\svn /a:-h /w /b /s | findstr /i /v ".svn"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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