Filenames Starting with a Dot

Link. February 25, 2008. Comments [8]. Posted in: Vista

In Unix, it's common to name files and folders with names starting with a '.' to make them "hidden". This convention is not really needed in Windows, since there's a file system attribute for that, but still interesting.

See, a few tools ported from Unix that relied on this convention use a different one in Windows, replacing the '.' with a '_'. So, for example, your Vim settings file will be "_vimrc" instead of ".vimrc" and so on. Seems pretty obvious they did this because at some point in time file/folder names could not start with a dot.

Windows 9x probably had this limitation, and probably still lives on in FAT-based file systems (but I don't have one anywhere to test this assertion, nor do I particularly care about it). However, modern Windows and NTFS have no such limitation. Almost.

See, NTFS certainly let's you create a folder named ".vimfiles" or a file named ".txt" for that matter. You can do so programatically using the standard file handling APIs. You can do it from the command line using mkdir/echo.

But you can't do it using Windows Explorer. For example, Vista and WinServer2k8 will complain that "You must type a filename" if you attempt to name a folder/file with a dot as the first character in the name.

Why Explorer explicitly disallows it, I'm not sure, but seems pretty funky. There are probably thousands of applications or utilities out there that might get confused with a file or folder named like that, though.


Monday, February 25, 2008 6:08:30 PM (SA Pacific Standard Time, UTC-05:00)
Visual Studio 2003 used to be very troublesome with .folders and files which was a real pain as Subversion created .svn folders for the metadata by default.

Most Windows based Subversion tools had the ability to switch this over to _svn for exactly that reason.

[)amien
Monday, February 25, 2008 6:28:51 PM (SA Pacific Standard Time, UTC-05:00)
Wasn't ASP.NET the one causing trouble? At least I remember reading something about it, though never caused me any trouble (or maybe it is IIS, trying to figure out the right mime type for it or something).

Either way, anyway you look at it, it is those tools/apps that are broken; not the file system semantics.
Monday, March 10, 2008 5:26:05 PM (SA Pacific Standard Time, UTC-05:00)
I believe Windows Explorer disallows filenames starting with a . because it's default setting of hiding File Extensions.
It deems .txt (for example) as just an extension so nothing would show after you named a file like this.
Flatliner
Monday, March 10, 2008 5:42:13 PM (SA Pacific Standard Time, UTC-05:00)
@Flatliner: That might very well be true; but, heck, I *always* disable that option as soon as I install windows; it's the most stupid setting anyone ever came up with.
Tuesday, March 11, 2008 5:13:08 PM (SA Pacific Standard Time, UTC-05:00)
Oh totally agree on that point, I also think it's a security risk to hide file extensions from users. (remember the old .vbs attachment viruses?). I was really hoping that setting would be off in Vista by default as part of MS's whole "secure by default" strategy. Sadly not.
Flatliner
Tuesday, March 11, 2008 5:17:56 PM (SA Pacific Standard Time, UTC-05:00)
I'm far more surprised that setting is still enabled by default on Windows Server 2008.
Wednesday, March 26, 2008 1:29:15 AM (SA Pacific Standard Time, UTC-05:00)
I wrote a lot of the Vim Win32 console mode code back in the mid-90s. If I remember correctly, NT 3.x supported FAT-16. I'm pretty sure Win95 (cursed be its name) did. And Bram had a policy at the time of trying to unify the Win32 and the DOS codebases as much as possible. A filename like .vimrc wouldn't have worked on FAT-16.

(Or something like that. I had to page these memories back in from tape, where they were stored with a lossy compressor.)
Wednesday, March 26, 2008 5:25:24 PM (SA Pacific Standard Time, UTC-05:00)
George: I wasn't singling VIM out, just using it as an example. And I do understand it was because of old FAT compatibility and stuff like that (which does make you wonder how long we'll carry that noose around our necks). And, btw, thanks for all the work on VIM :)
Comments are closed.

About

Tomas Restrepo is co-founder of devdeo ltda. His interests include .NET, Connected Systems, PowerShell and, lately, dynamic programming languages. More...

email: tomas@winterdom.com
msn: tomasr@passport.com
twitter: tomas_restrepo

Technorati Profile

devdeo logo

View my profile on LinkedIn

MVP logo

Syndicate

Ads

Links

Tag Cloud

.NET (232) Architecture (47) ASP.NET (6) BizTalk (170) Blogging (64) C++ (3) Castle (2) Commerce Server (3) Development (118) DLR (7) Enterprise Services (25) Fonts (4) Host Integration Server (1) LINQ (3) Linux (5) NHibernate (1) Personal (143) PowerShell (22) QuickCounters (4) Tools (74) Vista (38) VS Color Scheme (10) VSTO (2) WCF (64) Web Services (87) WinFX (80) Workflow (47) WPF (5) XML (21)

Statistics

Total Posts: 986
This Year: 56
This Month: 6
This Week: 0
Comments: 755

Blogroll

Post Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 1.9.7174.0

Sign In