Super User is a question and answer site for computer enthusiasts and power users. 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

Basically what I want is to hide all the files named:

  • .gitignore
  • gradle
  • gradle.bat
  • *.iml
  • *.ipr
  • *.iws
  • .classpath
  • .project

But I want them hidden by default, for any project I have, wherever they are on the hard disk and without setting the hidden attribute for any of those files.

I just want a rule or something like the "Don't show system files" but a rule that can be customized so I can tell which files I want to hide.

Note: I use only Windows Explorer for navigation.

share|improve this question
You could do this with a batch script - Loop through the system files looking for certain extension and when found, change the attribute. Although the attribute is H for hidden! – Dave Jan 14 '13 at 11:43
@DaveRook: please convert your comment to an answer so I can vote it... – Igor Popov Jan 14 '13 at 11:45
up vote 2 down vote accepted

I like Dave Rook's answer, and came up with a simpler solution...

For each requirement, simply go to the root drive and type

attrib (filetype) /S +h

for example

attrib *.ipr /S +h

will make all ipr files in to hidden files, in all subdirectories.

However, neither this or Dave Rook's answer meet your requirement of "automatic" and especially do not meet the requirement of not setting the hidden flag.

If you want to hide them without setting the hidden attribute, the only way I can think of doing it is via a shell extension to basically hide it from explorer - but, this is a very dangerous thing to do as this is a security risk on your machine/you are starting to get in the realm of rootkits.... You will need to basically program something yourself and then add it to the registry.

share|improve this answer
Does Robocopy not allow you to use Mon to monitor? I wonder if this could monitor the folder, and then on a change launch the batch script? Maybe not efficient. Alternatively, depending on how urgent it is, run a scheduled task each evening? +1 – Dave Jan 14 '13 at 12:05
@DaveRook well, you could create a service that has robocopy on all the time with monitor, or run a batch script via a scheduled task - but, it would take a while to search AND, it still sets the hidden flag, so, it doesn't meet the requirements :( – William Hilsum Jan 14 '13 at 13:16

You could do this with a batch script -

In theory, you will loop through the system files looking for certain extension and when found, change the attribute. Although the attribute is H for hidden!

There are many tutorials on how to loop through as well within a batch script. This code looks for files with a certain extension and then copies them - You could probably edit it, remove the copy part and add the attribute code

Untested, but something like (you would have to run it many times, changing the set ftype=*.Extension

set dSource=C:\Main directory\sub directory
set dTarget=D:\Documents
set fType=*.doc
for /f "delims=" %%f in ('dir /a-d /b /s "%dSource%\%fType%"') do (
    attrib /d +s +h "%%f"

If the code above doesn't work, then you may have to copy the file to its self (overwriting itself), and on the copy change the attribute type.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .