Page 1 of 1 1
Topic Options
#204376 - 2012-03-01 09:02 AM Total Folder Size ??
Jlmartinez Offline
Getting the hang of it

Registered: 2008-05-20
Posts: 75
Loc: Sevilla, Spain
Hello!!

I had doing a little script to find out the total folder size of some folders on my server.

example:

x:\department\dpt1
x:\department\dpt2
...

every folder have many subfolder and its size is over Gb´s...

and this is my script, on my computer is ok, but in the server doesn´t work:

$objFSO = CreateObject("Scripting.FileSystemObject")
$objFolder = $objFSO.GetFolder("$x")
? "Size is: " + (formatnumber(cdbl($objFolder.Size) / 1024 / 1024, 2)) + " MB."

Can you help me? thanks everyone!!

Top
#204377 - 2012-03-01 09:11 AM Re: Total Folder Size ?? [Re: Jlmartinez]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
"It doesn't work" is a bit vague.

Do you get any error messages if you check @error and @serror? What are the differences between the results on your local system and the server (no results at all or incorrect results)? What OS is the server running on? What version of kixtart are you running?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#204378 - 2012-03-01 09:23 AM Re: Total Folder Size ?? [Re: Mart]
Jlmartinez Offline
Getting the hang of it

Registered: 2008-05-20
Posts: 75
Loc: Sevilla, Spain
Sorry!!! you´re right!

on server(windows server 2003 R2 enterprise SP2):
@error show me: -2147352567
@serror show me: COM exception error "Size" ((null) - (null)) [-2147352567/80020009]

on my pc show me: size is 1,89 MB (is a example) Work Fine!
Kix version: 4.62

Thanks!

Top
#204379 - 2012-03-01 10:03 AM Re: Total Folder Size ?? [Re: Jlmartinez]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You should get rid of the quotes around your $x variable. It might work just fine like this but best practice says to not wrap variables in quotes. I Assume that $x gets filled somewhere earlier in your script because I do not see it getting filled with the actual folder you want to check in the code you posted.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#204380 - 2012-03-01 10:22 AM Re: Total Folder Size ?? [Re: Mart]
Jlmartinez Offline
Getting the hang of it

Registered: 2008-05-20
Posts: 75
Loc: Sevilla, Spain
Yes, my $x variable is only this, x:\department\dpt1
I´ve tried putting the string directly (instead of $x) and the script show me the same error.
Could it be that the folder size is too big?

Top
#204381 - 2012-03-01 01:55 PM Re: Total Folder Size ?? [Re: Jlmartinez]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I use the following script. DirPlus() is available in the UDF section.
 Code:
Break on
Call 'C:\KiX\scripts\UDF\DirPlus.udf'
If Exist('C:\HomeFolderHogs.csv')
  DEL 'C:\HomeFolderHogs.csv'
EndIf
$RC = Open(1,'C:\HomeFolderHogs.csv',5)
$RC = WriteLine(1,'"' + 'UserID' + '","' + 'Folder Size' + '"' + @CRLF)
$DirArray = DirPlus('\\cacc.local\ff\home\users','/ad') ;returns only a list of folders

For each $Dir in $DirArray
  $RC = WriteLine(1,'"' + $Dir.Name + '","' + $Dir.Size + '"' + @CRLF)
  $Dir.Name ?
Next
$RC = Close(1)
"That's all folks!" ?
 
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#204382 - 2012-03-01 02:14 PM Re: Total Folder Size ?? [Re: Les]
Jlmartinez Offline
Getting the hang of it

Registered: 2008-05-20
Posts: 75
Loc: Sevilla, Spain
Thanks! I´ll try it!
Top
#204383 - 2012-03-01 02:27 PM Re: Total Folder Size ?? [Re: Jlmartinez]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
The FSO is broke with Vista and up, on file size on certain folders. I ran into this in the past, but I can't seem to find the thread.

{edit. Here it is.
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=190300#Post190300 }


Edited by Allen (2012-03-01 02:32 PM)
_________________________
(... better days ahead)

Top
#204384 - 2012-03-01 05:14 PM Re: Total Folder Size ?? [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
maybe not broke (I did read what linked) as much as if it is denied access, it will return 0.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.193 seconds in which 0.126 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org