March 15th, 2011

Why can't Explorer decide what size a file is?

If you open Explorer and highlight a file whose size is a few kilobytes, you can find some file sizes where the Explorer Size column shows a size different from the value shown in the Details pane. What’s the deal? Why can’t Explorer decide what size a file is? The two displays use different algorithms. The values in the Size column are always given in kilobytes, regardless of the actual file size. File is 15 bytes? Show it in kilobytes. File is 2 gigabytes? Show it in kilobytes. The value shown in the Size column is rounded up to the nearest kilobyte. Your 15-byte file shows up as 1KB. This has been the behavior since Explorer was first introduced back in Windows 95, Why? I don’t know; the reasons may have been lost to the mists of time. Though I suspect one of the reasons is that you don’t want a file to show up as 0KB unless it really is an empty file. On the other hand, the value shown in the Details pane uses adaptive units: For a tiny file, it’ll show bytes, but for a large file, it’ll show megabytes or gigabytes or whatever. And the value is shown to three significant digits. The result is that a file which is, say, 19465 bytes in size (19.0088 kilobytes) shows up in the Size column as 20KB, since the Size column rounds up. On the other hand, the Details pane shows 19.0KB since it displays the value to three significant digits.

It looks like Explorer can’t make up its mind, and perhaps it can’t, but the reason is that the two places on the screen which show the size round in different ways.

Topics
Other

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.