**DONOTDELETE**
(Lurker)
2001-11-06 09:34 PM
Folder size

Hi all,

Newbi here. I've been working on a script to copy my users My Documents folders to the network server for backup. The part I'm having trouble with is I would like to exit if they have too much to copy. I've seen hints about GetFolderSize in the new release however it doesn't seem to be in the beta I downloaded. It doesn't show up as an available function in the docs either. I've seen a script about user defined functions, is there a way to create a function or will I have to send info to a text and pull the line of info out I need?

Thanks.

Bryce
(KiX Supporter)
2001-11-06 10:07 PM
Re: Folder size

you can find the GetFolderSize() UDF here
http://www.scriptlogic.com/Kixtart/FunctionLib/getfoldersize.asp

because of a limitation on win9x systems, a folder over 2gig will show up as 2gig for those systems.

Bryce

**DONOTDELETE**
(Lurker)
2001-11-06 10:24 PM
Re: Folder size

Been there, voted for it, tried it and couldn't get to go. My fault though... Fixed it and am on my way. Are UDFs assembled commands or is there more to it?

Thanks

MCA
(KiX Supporter)
2001-11-07 05:45 AM
Re: Folder size

Dear,

Function in kixtart2001 are simple a piece of code, which make it
possible to create a much easier to read your main script.
Also UDFs can easily reused.

Possible that Bryce can explain why

code:

? GetFolderSize("c:\")
? GetFolderSize("c:\work")
exit

function GetFolderSize($path)
DIM $fso, $fold
$GetFolderSize = -3
if exist($path) = 1
$FSO = createobject("scripting.filesystemobject")
$fold = $fso.getfolder($path)
$GetFolderSize = $fold.size
exit(0)
else
exit(3)
endif
endfunction



c:\ returns an empty result
and
c:\work returns the actual value.
greetings.


ClientMaster
(Fresh Scripter)
2005-10-31 02:51 PM
Re: Folder size

any ideas on how to display in MB?

Chris S.
(MM club member)
2005-10-31 02:54 PM
Re: Folder size

Yes, do the math on the file size (e.g. convert the bytes to MBytes).

Please do not hijack old threads in the future. Instead, start your own thread. There isn't much value in resurrecting a five year old thread.