Hardlinks not considered

The Size and Size on Disk column in Details mode do not consider hardlinks. This is especially visible on windows vista, where most DLL files in c:\windows\system32 are hardlinks to the files in c:\windows\winsxs. That makes my Vista installation on c:\windows having size of 9 GB+, whereas the real size is not that big. The Windows explorer's Properties dialog also cannot recognize hardlinks, I think it is good for Directory Opus to recognize it and be better than explorer.

It's the first I've heard that the files in System32 are hard links, but even if they are - hard links aren't like a junction or a soft link where they point to another directory entry. A hard link to a file is indistinguishable from the file itself - they are both just directory entries that point to the same data on the disk. You can delete either of them and the data is still there - it's only when the last link has been deleted that the data is removed.

It is possible to find out whether a directory entry has one or more additional hard links but as far as I know, there's no concept of an "original" entry - there is no way to tell which link to a file is the "original file" and which is a subsequently-created hard link. Therefore Opus has no way of knowing which of the files to exclude.

Yes, most of the DLL files in system32 are hardlinks.

I searched a reference and found this from msdn2.microsoft.com/en-us/library/bb188738.aspx
"The files in %windir%\system32 are usually hard links to the winsxs directory."

I understand about hardlinks just as you mentioned. What I mean is, since c:\windows\system32 and c:\windows\winsxs (and hence the hardlinked files inside) are below c:\windows, when dopus is queried about c:\windows, it should not double-count the file size.

I don't know whether there is a Windows API to get something like File ID so that you can know whether particular two files are hardlinked together. But there should be some way such that dopus can recognize that and not calculating the size incorrectly. It would be appreciated very much.

It looks like adding this would slow down the size calculation a fair amount because it would have to open every file to see if it has hardlinks pointing to it. To just get the size of a file you don't need to open it but the number of links isn't available via the same method.

To me it doesn't seem worth slowing down all size calculations just to correct the size report of probably one folder which people rarely care about the size of.

I wrote a quick test program to see what impact this would have on the time taken to calculate directory sizes and it seems to slow things down significantly. Even just on the 1,715 *.dll files in system32, with everything cached as much as it can be (I ran the test several times), it takes 4 or 5 seconds to open all the files and check their hardlink counts. By contrast, just calculating their sizes is almost instant. Extrapolating that to a large size calculation across many directories, the increased time would be pretty nasty.

Although I am not an expert developer on these things but I know some technical aspect. This program: schinagl.priv.at/nt/hardlinkshel ... llext.html is able to show the reference count for each file. If it is a hardlinked file, the refcount will be > 1. I could not find how to get the refcount for files, but if it is obtainable without opening the file, dopus can be made to consider only the file with refcount > 1 to check for duplicates (I mean 2 or more hardlinked files only be counted as 1). Is that possible?

Another possible suggestion is for dopus to have it's own property page rather than using Windows's. There it may have "Real size on disk" where the very accurate size is shown even though it may be slow.

Microsoft's documentation suggests there is only one way to get the link count, and that involves opening the file, so I expect that program is doing the same thing that my test program does.

Out of interest, why do you need to know the exact disk space used by your Windows directory?

OK, thanks for your information.

At first I did not want to know the exact disk space used by the Windows directory. However I thought something is not correct when I saw that the windows directory is 9 GB, some other directories in c: are 5 GB in total and I still have 6 GB free, but the partition size is only 16 GB. When I open system32 dir, I saw that many DLL files have small yellow arrow and I could not understand why the yellow arrow is there. Finally I tried the "mklink" commands and found that when I create hardlinks, the file icons will have small yellow arrow overlayed.

Sadly, until now I still do not know the correct size of Windows directory, I only can say to my friends like before: vista's windows dir takes 9 GB! It would be good for dopus to have a feature to know the exact size on disk of a folder.

I guess we could have an option for the 'Size on disk' column to take links into account. I'll put it on the list to think about.