Calculate real directory size on HDD (no links)
Moderators: Hacker, petermad, Stefan2, white
Calculate real directory size on HDD (no links)
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.
So the request is to be able to run dir size calculation (similar to cm_CountDirContent) omiting any hard/soft links and junctions.
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...
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.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...
Example:Hacker wrote:Hello Nux,Is there a difference between those two?TC should only count it where it originally is, not where it's NTFS links are.
Roman
* 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.
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;
}
DirSizeCalc has an option to continue calculation for mount points and junctions or stopping there.
http://www.totalcmd.net/plugring/dirsizecalc.html
http://www.totalcmd.net/plugring/dirsizecalc.html
Thank you! You just saved me from witting a Python script for thatLefteous wrote:DirSizeCalc has an option to continue calculation for mount points and junctions or stopping there.
http://www.totalcmd.net/plugring/dirsizecalc.html

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.