Folder size calculation when it contains junction

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Folder size calculation when it contains junction

Post by *MVV »

Hi to all, I want to introduce one little bug.

For example, I have a folder C:\tmp with subfolder C:\tmp\1 (lets say it's size is 1 MB) and it's junction as C:\tmp\2. When I try to calculate size of folder C:\tmp, TC says 2 MB while Windows Explorer says 1 MB. Mismatch.

Go on, make a junction to C:\tmp\1 as C:\tmp\1\1 (i.e. folder link inside this folder). Windows says folder size is 1 MB... But TC says... about 40-50 MB!!! (I think, later calculation is impossible because of long path)

So I think TC shouldn't calculate size of a junction (as Windows Explorer).

I.e. if a folder has inside only junctions to other folders, Windows says it has size 0 B. But in folder tree Windows tries to open infinity loop of junctions... :lol:

Copying such symbolic link also buggy - TC copies it with all of it's infinity subfolders. (but it is my buggy fault :))
BTW, it isn't hard to check if a junction points to upfolder and make its analog. (but is it really what we need?)
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

Well, I don't call this a bug, but expected behaviour !

You told TC to count the bytes, an he did it.
Please copy C:\tmp to another drive and come back with the number of bytes copied ;)

Don't call Windows Explorer to be right. All MS OS prior to Vista cannot handle junctions correctly: Deleting a junction using Windows Explorer will delete the content too (TC removes the junction entry only)
#5767 Personal license
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

While copying it is ambiguous what it is better. Possibly it is better to copy junction. But at this case I agree with Windows - junction is a link but not a folder. So, it's size it is better not to calculate. At this place Windows do the thing because this action is not default for usual folders.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

It really depends on the concrete task which leads the user to find out the size of a directory. In all cases it's important to know if the directory is actually a junction. In your example Explorer displays another value but not 0 which means the junction must be in a subdirectory of the directory.

My DirSizeCalc plugin can be used to calculate
- the directory size including the size of all contained junctions
- the directory size excluding the size of junctions in subdirectories
- the directory size for normal directories, never calculate size for junctions
http://www.ghisler.ch/board/viewtopic.php?p=150981#150981

The bundled configuration tool can be used to configure the field as required.
User avatar
norfie²
Power Member
Power Member
Posts: 986
Joined: 2006-02-10, 07:27 UTC

Post by *norfie² »

So, it's size it is better not to calculate.
No, it's not. It depends on what you want to do with specific datas.

How complicated this issue is really shows a tool of the german magazin c't ctts.exe
Links to German articles
http://www.heise.de/ct/ftp/08/01/180/
http://www.heise.de/ct/faq/hotline/08/04/12.shtml
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It is ambiguous question to do or not to do...

Eh... Now I think that really it is better to calculate dir size with junctions as subfolders. Because so we can use two different methods - by TC and by Explorer. Because we know the difference! :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed TC is counting with the junctions here because they would be copied too when you press F5 instead of counting.
Author of Total Commander
https://www.ghisler.com
Post Reply