Calculate real directory size on HDD (no links)

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Calculate real directory size on HDD (no links)

Post by *Nux »

With Windows 7 symlinks and hardlinks all over the place it's very hard to tell what the real size of the a given folder is. For example Windows directory seem to take a LOT of space while in fact there are many internal links doubling it's apparent size. I also have many links from SSD to other, bigger drives and it makes the job to optimize space even more difficult...

So the request is to be able to run dir size calculation (similar to cm_CountDirContent) omiting any hard/soft links and junctions.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can open properties dialog to get Windows size w/o junctions.

But it is impossible to count size w/o hardlinks because every file hardlink is a usual file record. E.g. if file has 3 hardlinks, 2 under Windows and third under Program Files, it is a big question where to count its size because all 3 file records point to single file data...
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Post by *Nux »

MVV wrote:You can open properties dialog to get Windows size w/o junctions.

But it is impossible to count size w/o hardlinks because every file hardlink is a usual file record. E.g. if file has 3 hardlinks, 2 under Windows and third under Program Files, it is a big question where to count its size because all 3 file records point to single file data...
In this case TC should only count it where it originally is, not where it's NTFS links are. Link size is small to none so not important when one needs to know if some folder should be moved to other HDD or not.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Please search the board, it was discussed many times why TC counts junctions like folders.
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Post by *Nux »

MVV wrote:Please search the board, it was discussed many times why TC counts junctions like folders.
My use case is I need to know the HDD size of all sub-folders. This is my feature request. Not interested what will be default behavior.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Hello Nux,
TC should only count it where it originally is, not where it's NTFS links are.
Is there a difference between those two?

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Post by *Nux »

Hacker wrote:Hello Nux,
TC should only count it where it originally is, not where it's NTFS links are.
Is there a difference between those two?

Roman
Example:
* You have a folder on D:\Data\Netbeans\
* The folder is mounted to: C:\Users\MyUser\AppData\Local\NetBeans\

I want to check physical size of all sub-folders in:
C:\Users\MyUser\AppData\
But I don't care about size that is taken from D.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Nux,
How would you differ between data on C and data on D?

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Post by *Nux »

Hacker wrote:Nux,
How would you differ between data on C and data on D?

Roman

Code: Select all

int calculateRealDirSize(rootDir)
{
	size = 0;
	foreach(dir in rootDir.subdirs)
	{
		if (dir.isNtfsLink)
		{
			continue;
		}
		size += calculateRealDirSize(dir);
	}
	size += fileSize(rootDir);
	return size;
}
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Nux, as I said it was discussed already, you can use Alt+Enter to open system Properties window with size w/o counting junctions. Or maybe some plugin can count sizes in such way.
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

DirSizeCalc has an option to continue calculation for mount points and junctions or stopping there.

http://www.totalcmd.net/plugring/dirsizecalc.html
Nux
Junior Member
Junior Member
Posts: 40
Joined: 2009-04-19, 08:05 UTC

Post by *Nux »

Lefteous wrote:DirSizeCalc has an option to continue calculation for mount points and junctions or stopping there.

http://www.totalcmd.net/plugring/dirsizecalc.html
Thank you! You just saved me from witting a Python script for that :-). Now I have a custom view which includes real size column.

Still would be nice to have this built in for some command or configurable. I don't see a problem really. Shouldn't be much of an effort NTFS link discovery is already there, on-demand size calculation for many files too. Just add one new configuration option (even in ini alone) and use one or two ifs.
Post Reply