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.

Many cross platform tools use the unix convention of prefixing directory names with a period to indicate they are meta directories and should not be included in file listings and directory searches. Is there a way to configure Windows so that it treats directories with a leading period as if they had the 'hidden' attribute applied?

share|improve this question

migrated from stackoverflow.com Apr 29 '11 at 18:05

This question came from our site for professional and enthusiast programmers.

add comment

5 Answers 5

You can't do that by normal way. Perhaps with some software...

Below, you can see an way - not the best, but to do manually for your particular case. For both cases, you must hide files with hidden attribute in Windows Explorer > Tools > View mode:

  • Dos command (you can create a batch replacing each % character below with %%, and use it to initialize each time Windows is started, or when you want; use "attrib +h +s" if you want to show hidden files but hide system files; if you want to apply it for files, remove /ad parameter from dir):

    for /f "delims=" %i in ('dir /s /b /ad ".*"') do attrib +h "%i"
    
  • Windows Search (for Windows 7, you must enable classic search): search for the string ".*", then do mouse right click on directories and mark "hidden" (using this way, you cannot add system attribute)

share|improve this answer
add comment

I don't think there's any way to do this -- Windows doesn't even let you name files like that from within Explorer (you need the command prompt), so I don't think it would be very friendly toward treating them as hidden :(

share|improve this answer
    
It lets you if you know a trick. Just use .name. and you will have .name folder created. This works from Windows 7 upwards and probably in Vista,but who cares about Vista... –  PSIXO Apr 11 at 18:05
add comment

You can't do this in general in Windows. Hidden files in Windows are determined by an attribute rather than a name convention. That's just set in stone. The best you can get is to use the GNU tools, e.g. ls which behave the same on Windows as they do on *nix.

share|improve this answer
add comment

One thing you can do is hide them manually, i do this for my home folder that has alot of files and directories that begin with dot and with underscore, the last character used for VIM. Open a powershell and execute this two lines:

YourPSPrompt>> ls | ? {$_.name -match "^\.(.)*"} | % {attrib.exe +h $_.name}
YourPSPrompt>> ls | ? {$_.name -match "^_(.)*"} | % {attrib.exe +h $_.name}
share|improve this answer
add comment

I think the reason you can't do this at all is because in Windows, a lone period means "current directory". So .\..\SiblingFolder means exactly the same as ..\SiblingFolder.

share|improve this answer
    
Yes, a single period (.) means "current directory" and two periods (..) means "parent directory" in Unix as well. When you do a directory listing, you usually hide/ignore those "virtual" directories. But (at least in early Unixes), they aren't actually virtual directories, but hard links, and thus ordinary filesystem entries like other files and directories. The ls command hides . and .. by default, but also hides any other file or directory with a name that starts with . (e.g. .foo). Many Unix programs make use of this feature to "hide" conf files in the user home directory. –  Daniel Pryden Apr 29 '11 at 23:47
    
@Daniel Pryden: I think it varies with OS version in Windows, but at least some MS Directory Services return . and .. in scan functions. I screen them out in my code by checking for those two particular names. Maybe the corresponding Unix service does that screening for you - but lazily, by just checking if the first char is a period. –  FumbleFingers May 1 '11 at 2:21
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.