|
I need that it show the file size in MB, actually have showing in this format:
138786567 KB
without points, it appears to be very hard to understand.
I want that it show like this: 138 MB
Thanks a lot.
W R
Computadores Colombia
Bogotá D.C.
|
|
|
|
|
I have the same question.
If you know how to set it, please tell me.
Thanks a lot.
|
|
|
|
|
|
Has <bold> anybody got the solution?
|
|
|
|
|
Here is code which convert size into String, with respective postfixes like MB, GB, KB, B etc and also display round off fractions upto two digits.
//----------------------------------------------------------------------------
char * GetSizeString(unsigned long size,char str[])
{
char temp[100]="";
double dsize=size;
if (size==0)
{
ultoa(size,temp,10);
strcat(temp," KB");
}
else if (size<1024)
{
ultoa(size,temp,10);
strcat(temp," B");
}
else if (size<1048576)
{
ULONG rem=size/1024;
ULONG deciml=size- (rem*1024);
ultoa(rem,temp,10);
if (deciml!=0)
{
char temp1[10];
strcat(temp,".");
ultoa(deciml,temp1,10);
temp1[2]=NULL;
strcat(temp,temp1);
}
strcat(temp," KB");
}
else if (size < 1073741824)
{
//dsize /= 1048576.0;
ULONG rem=size/1048576;
ULONG deciml=size- (rem*1048576);
ultoa(rem,temp,10);
if (deciml!=0)
{
char temp1[10];
strcat(temp,".");
ultoa(deciml,temp1,10);
temp1[2]=NULL;
strcat(temp,temp1);
}
//doubleToString(dsize,temp,2);
//gcvt(dsize,5,temp);
strcat(temp," MB");
}
else
{
//dsize /= 1073741824.0;
ULONG rem=size/1073741824;
ULONG deciml=size- (rem*1073741824);
ultoa(rem,temp,10);
if (deciml!=0)
{
char temp1[10];
strcat(temp,".");
ultoa(deciml,temp1,10);
temp1[2]=NULL;
strcat(temp,temp1);
}
//gcvt(dsize,2,temp);
strcat(temp," GB");
}
strcpy(str,temp);
return str;
}
//--------------------------------------------------------------------------
Ayaz
|
|
|
|
|
StrFormatByteSize() does it for you.
CHeers,
Axel
|
|
|
|
|
The screenshot showd the size in mb. The alignment should also have been changed to "right".
|
|
|
|
|
Search for LVCFMT_LEFT in the project and change it to RIGHT to get right alignment. Also search for the line size = dwSize/(1024*1024); in ColHandler.cpp and uncomment the section to convert to MB.
|
|
|
|
|
I'm not a coder, just a user happy to find this. Any chance someone could post a version for MB, right aligned? Would be greatly appreciated!
|
|
|
|
|
I would also like the right aligned MB version if possible. My email is breakaway1029 [at] yahoo [dot] com . Thanks
|
|
|
|
|
me too please~! lonesan (at) gmail (dot) com
thanks
Lone
|
|
|
|
|
i can find these commands but once i have updated the file does this change the dll or should it reregistered ?
i implemented this file by registering the demo dirsize.dll
robbie - happy but confused
|
|
|
|
|
HI
Woluld U be so kind and sent the MB updated version of the DirSize.Dll to jurarafal @ gmail.com , pls
thanks in advance
JUra
jura
|
|
|
|
|
OK, I made the ColHandler.cpp changes suggested and downloaded the Windows Server R2 Platform for SDK and installed it.
For a non-programmer what are the commands necessary to make a new .dll so I can see the files in MB?
MXX wrote: ForumFolder Size Information in the Windows Explorer Details view
Subject:Re: Show size in MB
Sender:MXX
Date :47 27 Dec '04
Search for LVCFMT_LEFT in the project and change it to RIGHT to get right alignment. Also search for the line size = dwSize/(1024*1024); in ColHandler.cpp and uncomment the section to convert to MB.
-Nothing is foolproof for fools can be incredibly ingenious.
|
|
|
|
|
First:
Thanks for that gread add-on. It really makes the explorer more useable.
I suggest changing the text alignment to right-aligned - this improves legibility.
|
|
|
|
|
Very cool add-on, something MS should've added to Explorer a long time ago...
I'll admit I haven't looked at the source yet, nor do I know anything about what's involved in creating such an extension, but...
Since Explorer already has a "Size" column, is it possible at all to use it to display the folder size, instead of having a separate column for this? Right now we end up with this:
<br />
Name Size FolderSize [Type] [OtherColumns]<br />
[foldername] [empty] [size] File Folder<br />
[foldername] [empty] [size] File Folder<br />
[foldername] [empty] [size] File Folder<br />
[filename] [size] [empty] File Type<br />
[filename] [size] [empty] File Type<br />
[filename] [size] [empty] File Type<br />
(damn the formatting...i dunno how to do this) :-p View it using a fixed-size font
|
|
|
|
|
I save a column by reporting files size and folders size in the same one when i got this codes. but for the sake of speed, some rules should be made.
One is 'the limits of Max recusive number of files and/or folders'. If a folder has too many files or subfolders, the answer can just be "too many..." or other flag like ">Max". this limit can be calculated according to CPU's type.
anyway, it's a good stuff, i give my thanks to the coder!
|
|
|
|
|
i make many changes:
-1)add a GetFileSize() function;
-2)give a number gap of 1000, like 3,234,122;
-3)use 2 kinds of unit to make difference, K" for folders, KB for files;
-4)use "files + folders <200" as recusive limit, and add '~' just for large scale folders, it gets much faster;
-5)text fmt is now set to "right" side;
....so "size" column now looks like:
```````````````````~21,813 K"| folder
`````````````````````1,332 KB| file
I put the whole file of "colhandler.cpp", header file is easy to edit.
==========================================================
<small>
#include "stdafx.h"<br />
#include "DirSize.h"<br />
#include "ColHandler.h"<br />
<br />
<br />
STDMETHODIMP CColHandler::Initialize(LPCSHCOLUMNINIT psci)<br />
{<br />
return S_OK;<br />
}<br />
<br />
STDMETHODIMP CColHandler::GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO *psci)<br />
{<br />
TCHAR szText[] = "size";<br />
<br />
psci->scid.fmtid.Data1 = 0x28636AA6L;<br />
psci->scid.fmtid.Data2 = 0x953D;<br />
psci->scid.fmtid.Data3 = 0x11D2;<br />
strcpy((char *)psci->scid.fmtid.Data4,"B5D600C04FD918D0");<br />
<br />
psci->scid.pid = 12;<br />
psci->vt = VT_BSTR;<br />
psci->fmt = LVCFMT_RIGHT; psci->cChars = 35;<br />
psci->csFlags = SHCOLSTATE_TYPE_STR|SHCOLSTATE_SLOW;<br />
<br />
<br />
MultiByteToWideChar( CP_ACP, 0, szText,<br />
strlen(szText)+1, psci->wszTitle, <br />
sizeof(psci->wszTitle)/sizeof(psci->wszTitle[0]) );<br />
<br />
MultiByteToWideChar( CP_ACP, 0, szText,<br />
strlen(szText)+1, psci->wszDescription, <br />
sizeof(psci->wszDescription)/sizeof(psci->wszDescription[0]) );<br />
<br />
if(dwIndex == 0)<br />
{<br />
return S_OK;<br />
}<br />
else<br />
{<br />
return S_FALSE;<br />
}<br />
}<br />
<br />
STDMETHODIMP CColHandler::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)<br />
{<br />
USES_CONVERSION;<br />
V_VT(pvarData) = VT_BSTR;<br />
DWORD dwSize = 0;<br />
char szTmp[200],sz_[200];<br />
DWORD dwFiles = 0, dwFolders = 0;<br />
BOOL bLimit=false;<br />
<br />
DWORD64 size = 0;<br />
if( pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )<br />
dwSize = GetFolderSize(OLE2T(pscd->wszFile),&dwFiles,&dwFolders,&bLimit);<br />
else<br />
{<br />
dwSize = GetFileSize(OLE2T(pscd->wszFile),&dwFiles,&dwFolders);<br />
}<br />
<br />
{<br />
size = dwSize/1024;<br />
if(dwSize%1024)<br />
size++;<br />
_i64toa(size,szTmp,10);<br />
<br />
int len=strlen(szTmp);<br />
int index=0;<br />
memset(sz_,0,200);<br />
if(bLimit)<br />
{<br />
strcat(sz_,"~"); index+=1;<br />
}<br />
<br />
int iTmp=len%3;<br />
if(iTmp!=0)<br />
{<br />
memcpy(sz_+index,szTmp,iTmp);<br />
index+=iTmp;<br />
len-=iTmp;<br />
<br />
if(len>0)<br />
{<br />
strcat(sz_,",");<br />
++index;<br />
}<br />
}<br />
<br />
while(len>0)<br />
{<br />
memcpy(sz_+index,szTmp+iTmp,3);<br />
index+=3;iTmp+=3;len-=3;<br />
if(len>0)<br />
{<br />
strcat(sz_,",");<br />
++index;<br />
}<br />
}<br />
if( pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )<br />
strcat(sz_," K\"");<br />
else strcat(sz_," KB");<br />
}<br />
<br />
V_BSTR(pvarData) = SysAllocString(T2OLE(sz_));<br />
<br />
return S_OK;<br />
}<br />
<br />
<br />
DWORD CColHandler::GetFolderSize(LPCTSTR szPath, DWORD *dwFiles, DWORD *dwFolders,BOOL *bLimit)<br />
{<br />
TCHAR szFileFilter[512];<br />
TCHAR szFilePath[512];<br />
HANDLE hFind = NULL;<br />
WIN32_FIND_DATA fileinfo;<br />
DWORD dwSize = 0;<br />
<br />
strcpy(szFilePath,szPath);<br />
strcat(szFilePath,"\\");<br />
strcpy(szFileFilter,szFilePath);<br />
strcat(szFileFilter,"*.*");<br />
<br />
<br />
hFind = FindFirstFile(szFileFilter,&fileinfo);<br />
do<br />
{<br />
if(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )<br />
{<br />
if (!strcmp(fileinfo.cFileName,".") || !strcmp(fileinfo.cFileName,".."))<br />
{<br />
}<br />
else<br />
{<br />
TCHAR sztmp[512];<br />
strcpy(sztmp,szFilePath);<br />
strcat(sztmp,fileinfo.cFileName);<br />
dwSize = dwSize + GetFolderSize(sztmp,dwFiles,dwFolders,bLimit);<br />
if(dwFolders != NULL)<br />
++(*dwFolders);<br />
}<br />
}<br />
else<br />
{<br />
if(dwFiles != NULL)<br />
++(*dwFiles);<br />
}<br />
<br />
dwSize += fileinfo.nFileSizeLow;<br />
if(dwFolders && dwFiles && bLimit)<br />
{<br />
if(*dwFolders+*dwFiles>200)<br />
*bLimit=true;<br />
}<br />
}while(FindNextFile(hFind,&fileinfo)&& ((bLimit!=NULL && !(*bLimit))||!bLimit) );<br />
<br />
FindClose(hFind);<br />
return dwSize;<br />
<br />
}<br />
<br />
DWORD CColHandler::GetFileSize(LPCTSTR szPath, DWORD *dwFiles, DWORD *dwFolders)<br />
{<br />
WIN32_FIND_DATA fileinfo;<br />
HANDLE hFind = FindFirstFile(szPath,&fileinfo);<br />
FindClose(hFind);<br />
return fileinfo.nFileSizeHigh * (MAXDWORD+1) + fileinfo.nFileSizeLow;<br />
}</small>
=====================================================
|
|
|
|
|
Great addition to this.
Did you guys notice that the sorting doesn't work properly now though? it sorts it as if it is a character field, not a numeric field...
Any suggestions on how to fix?
-Matt
|
|
|
|
|
Hello,
i registered the DirSize.dll, but I didn't found any new column named "Folder Size" or something to add to. I have got a german Version of Windows.. may be, thats the "failure"...?
Greetings
Sven
|
|
|
|
|
Sorry, to much details in the list.. I found it between 240 others...
|
|
|
|
|
i register dll. cmd gave me full registered msg but No extra Column after registering dll even checking with sort. can you help?
Abdullah GD (Mr.Green)
Focus Media Vision
|
|
|
|
|
Newbie in over his head, don't know anything about programming and shouldn't have installed the DirSize.dll but i did. Now Windows Explorer runs slowwwwwwww and i would like to remove said item but i'm sure its not as simple as deleting the file from my hard drive.
thank you
|
|
|
|
|
Go to Start/Run and type:
regsvr32 /u DirSize.DLL
If you put the .dll file in a folder somewhere then insert the folder name BEFORE the dirsize.dll.
Example: regsvr32 /u c:\dllfiles\DirSize.DLL
Pooja
|
|
|
|
|
|