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.

Windows does not use the dot-file convention for hidden files. However, many Windows applications (mostly opensource/cross-platform) use files and folders with this convention. How can I make Windows Explorer automatically hide these dot-files?

share|improve this question
add comment

5 Answers 5

up vote 8 down vote accepted

ATTRIB +H /s /d C:\.* is the command to hide anything, directories included that start with a dot

Edit: was meant to be a comment to the other fellow mentioning just ATTRIB +H

share|improve this answer
1  
only thing that sucks about this... it doesn't output anything. No way to verify which files it touched. =( –  Mechaflash Dec 14 '11 at 19:38
add comment

Windows will hide files with the hidden or system flag. Or files may be hidden using ACL. Windows does not hide files based on filename.

To explicitly have Windows to hide files by filename, you'll need to explicitly create the feature. Either a file system driver (it use to be common for viruses to have this "feature") or a shell extension hack will work in this case.

On a side note, you can fake the feature by turning off "view file extensions" under Folder Options, since, to Explorer, a file that starts with a dot is a file with an extension, but no name.

share|improve this answer
2  
Windows does not have an option to hide all file extensions. This is the only related option: Folder Options > View > [ ] Hide extensions for known file types. –  iglvzx Dec 4 '11 at 7:20
    
Like I said, not a real feature. –  surfasb Dec 4 '11 at 7:34
add comment

Simple:

In Windows Explorer

  1. Right click on the .folder you want to hide;
  2. Click properties, then click on the general tab;
  3. Click on hidden.

Done.

PS Only checked on Windows 7 Professional. PPS I noticed your question asked for doing this automatically. Clearly this won't cut it, but maybe readers find it useful.

share|improve this answer
add comment

It is possible in C#, using System.IO.FileSystemWatcher. Code would be something like this. Just compile it and place it in the Start Up folder. But this code doesnt hide already existing files. So run first the code from Luke, and than this code. You need the System.IO and System.Security.Permissions

    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    public static void Run()
    {
        FileSystemWatcher watcher = new FileSystemWatcher();
        watcher.Path = "C:\\";
        watcher.IncludeSubdirectories = true;
        watcher.Filter = "*.*";
        watcher.Renamed += new RenamedEventHandler(OnRenamed);
        watcher.Created += new FileSystemEventHandler(watcher_Created);
        watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
        watcher.EnableRaisingEvents = true;
        Console.WriteLine("Started...");
        while (true) ;
    }
    static void Check(string filename)
    {
        string name = Path.GetFileName(filename);
        if (name.StartsWith(".") && !File.GetAttributes(filename).HasFlag(FileAttributes.Hidden))
        {
            File.SetAttributes(filename, File.GetAttributes(filename) | FileAttributes.Hidden);
        }
    }
    static void watcher_Created(object sender, FileSystemEventArgs e)
    {
        Check(e.FullPath);
    }
    private static void OnRenamed(object source, RenamedEventArgs e)
    {
        Check(e.FullPath);
    }
}
share|improve this answer
add comment

I don't think there's a way to make it happen automatically, but you could try using the ATTRIB command to hide those files:

ATTRIB +H

Then make sure that you've configured Explorer to not show hidden files.

share|improve this answer
add comment

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.