Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
You could do this with a batch script - xxcopy.com/xxcopy06.htm Loop through the system files looking for certain extension and when found, change the attribute. Although the attribute is H for hidden! –  Dave Rook 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

2 Answers 2

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 Rook 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 - http://www.xxcopy.com/xxcopy06.htm

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

Your Answer

 
discard

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.