Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


"Size on Disk" - Is it even possible?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60205
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "Size on Disk" - Is it even possible?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 "Size on Disk" - Is it even possible? - 5/14/2008 9:40:17 AM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
I have read and searched all over, does not seem to be a straight forward way of obtaining the actual "Size on Disk" property.
Standard FSO object just returns Size.

Any reccomendations?
 
 
Post #: 1
 
 RE: "Size on Disk" - Is it even possible? - 5/14/2008 11:27:38 AM   
  TNO


Posts: 1072
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
A hard drive is divided up into 4kb memory clusters (99% of the time) which equals 4,096 bytes.

So with just that information just do the math:


      

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to yfki)
 
 
Post #: 2
 
 RE: "Size on Disk" - Is it even possible? - 5/14/2008 5:25:38 PM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
That script wont work for me. In my case I'm working with IBM Tivoli TSM/HSM.

Trying to put together some numbers on directories to see if the should be migrated.
When looking at a directory that has files that have been migrated, the "Size on Disk" is most relevant, being that Size does not excluse files that have been migrated.

i.e
Size on Disk: 800MB
Size 167GB

So the only accurate representation of the real size of the directory is "Size on Disk".

(in reply to TNO)
 
 
Post #: 3
 
 RE: "Size on Disk" - Is it even possible? - 5/14/2008 10:45:27 PM   
  TNO


Posts: 1072
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
I think you would have to drill into the folder and evaluate every file. I'm pretty sure that's what the operating system does anyway. I looked at all the documentation I could find, and there doesn't seem to be a property for Size On Disk.

Maybe someone who is more keen on WMI might know of a class I don't, but the usual FSO methods + the entended properties don't include Size On Disk

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to yfki)
 
 
Post #: 4
 
 RE: "Size on Disk" - Is it even possible? - 5/15/2008 3:51:00 AM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
I found a solution, its Perl, and works great!!

http://search.cpan.org/~arich/Win32-DirSize-1.13/

< Message edited by yfki -- 5/15/2008 10:53:28 AM >

(in reply to TNO)
 
 
Post #: 5
 
 RE: "Size on Disk" - Is it even possible? - 5/17/2008 3:32:16 PM   
  TNO


Posts: 1072
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Perl is allowed to access the Win32 API. (Which is denied to WSH for whatever reason). Powershell and JScript.NET can acess this API as well, but I think this is all running left field of a VBS solution. So, after some research, it seems you can use something called the dynawrap dll to access the Win32 API. I didn't find the actual .dll yet though

Edit: There is a WMI class for this as well, but it only works if the target file/folder is compressed on an NTFS drive

< Message edited by TNO -- 5/17/2008 3:34:05 PM >


_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to yfki)
 
 
Post #: 6
 
 RE: "Size on Disk" - Is it even possible? - 5/18/2008 5:10:06 AM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
http://cwashington.netreach.net/main/tools/default.asp?topic=a-m


      



Taken from Readme that accompanies dynwrap.dll
'*************************************************
This is the dynacall.dll that I described as "bringing back the Declare
statement"  in VBScript. Basically it will allow you to call functions
in other dlls...like any of the win32 api functions. This will be my
only distribution.

Many thanks to Ton Plooy and Jeff Stong who wrote the code and published
it in WDJ. And more thanks to William Epp for getting it to work with my
sample script ccupd.vbs using the GETPROFILESTRING function. However I
have another function in the sample that still doesn't work
GETPROFILESECTION. This is a work in progress but I think it is a handy
little feature. Hopefully by this distributions it will get where it
needs to be. Clarence and Ian have offered to post it on their sites so
further updates can be had at either WSH site. (anyone else call this
thing woosh? Hopefully it will perform this way).

Basically you declare functions and other DLLS like this:

'   Create the wrapper object for dynamic DLL function calling
Dim UserWrap
Set UserWrap = CreateObject("DynamicWrapper")
'   GetProcAddress for GetPrivateProfileStringA()
UserWrap.Register "kernel32.DLL", "GetPrivateProfileString", "i=ssssls",
"f=s", "r=l"


The input parameters are:

i=describes the number and data type of the functions parameters

f=type of call _stdcall or _cdecl. So it can work with both MS C++ and
Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If
that doesn't work good luck!

r=return data type.


Data types are:

const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*),    VT_DISPATCH}, // a   IDispatch*
{'c', sizeof(unsigned char), VT_I4},       // c   signed char 
{'d', sizeof(double),        VT_R8},       // d   8 byte real
{'f', sizeof(float),         VT_R4},       // f   4 byte real
{'k', sizeof(IUnknown*),     VT_UNKNOWN},  // k   IUnknown*
{'h', sizeof(long),          VT_I4},       // h   HANDLE
{'l', sizeof(long),          VT_I4},       // l   long
{'p', sizeof(void*),         VT_PTR},      // p   pointer
{'s', sizeof(BSTR),          VT_LPSTR},    // s   string
{'t', sizeof(short),         VT_I2},       // t   short
{'u', sizeof(UINT),          VT_UINT},     // u   unsigned int
{'w', sizeof(BSTR),          VT_LPWSTR},   // w   wide string
}

William Epp added anr 'r' for VT_BYREF (pass by reference)but is for
strings only. This made the GETPROFILESTRING function to work. But it
didn't work for the GETPROFILESECTION. If anyone gets it to work please
let me know.


Attachments:

stong.zip - original download from WDJ
DynaWrap.zip - the modified code, the DLL with modifications.
feature.htm - the feature article for this code by Jeff Stong. Only
thing I could find on WDJ. I couldn't find Ton's article.

< Message edited by yfki -- 5/18/2008 5:16:48 AM >

(in reply to TNO)
 
 
Post #: 7
 
 RE: "Size on Disk" - Is it even possible? - 5/18/2008 6:27:38 AM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
Google cache with great write up on this .dll and its use.

http://64.233.169.104/search?q=cache:wCmRP96HM_oJ:www.stealthbot.net/board/index.php%3Fshowtopic%3D7577%26view%3Dgetlastpost+http://www.stealthbot.net/board/index.php%3Fshowtopic%3D7577%26view%3Dgetlastpost&hl=en&ct=clnk&cd=1&gl=us

(in reply to yfki)
 
 
Post #: 8
 
 RE: "Size on Disk" - Is it even possible? - 5/18/2008 9:36:49 AM   
  yfki

 

Posts: 73
Score: 0
Joined: 12/12/2007
Status: offline
This could be a great way of hiding a cmd prompt when using .exec method.


      

< Message edited by yfki -- 5/18/2008 9:42:38 AM >

(in reply to yfki)
 
 
Post #: 9
 
 RE: "Size on Disk" - Is it even possible? - 5/18/2008 12:48:48 PM   
  TNO


Posts: 1072
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Indeed, its an excellent .dll, I've heard of this object for a few years in passing but never actually used it first hand.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to yfki)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "Size on Disk" - Is it even possible? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts