Page 1 of 1 1
Topic Options
#61228 - 2001-12-10 10:01 PM Question about funktion "FindLargeFolders"
Anonymous
Unregistered


Hi!

I'm wondering if it's possible to use the "FinLargeFolders"-funktion to get some sort of quota management....
say for example:
**************************************
$Size=100
IF FindLargeFolders("C:\Test",$Size) >$Size
? "You have one or more folders that are bigger than $Size Mb"
else
? "No folder is bigger than $Size Mb"
ENDIF
**************************************
I know that this is no where near a correct code, but it shows my thoughts.

Is this possible?

//Frippe

[ 10 December 2001: Message edited by: Frippe ]

Top
#61229 - 2001-12-10 10:15 PM Re: Question about funktion "FindLargeFolders"
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
here is an admin script that i use to find my biggest users and send then am email saying that they are over their size limit.
http://kix.isorg.net/other_scripts/AdminScripts/NT_Admin/DirUse.kix

Bryce

Top
#61230 - 2001-12-11 07:00 PM Re: Question about funktion "FindLargeFolders"
mvdw Offline
Starting to like KiXtart

Registered: 2001-05-01
Posts: 124
Loc: Voorburg, Netherlands
Hi Frippe,

Yes it is, a small modification would enable you to call the function with a certain parameter about the maxsize, and set the function to return True/False if a (sub-)folder is found larger than that.

Depends on what exactly you want to do... you could replace the line where it prints the foldername, and use that to set the function's returnvalue to true. Remember to set the initial value to false and also flag the first call of the function as it is recursive ...

if you need help, send me a msg, i'll modify the code for you..

I must say that what you are suggesting is not really effective, users will quickly learn to ignore such warnings. You could perform some more rigorous actions instead of the warning, possibly log to a central file or mail something to somebody. But then again, you could also just run the function over all your userdirs every now and then. It all depends on the situation..

_________________________
rgrds, Maarten

Top
#61231 - 2001-12-11 09:24 PM Re: Question about funktion "FindLargeFolders"
Anonymous
Unregistered


Hi Maarten!

If you could modify the code it would make me very happy...

The "warning" were just an example.
What I have in mind is to use the "shutdown" or "logoff" funktion.

What I really have in mind is something like this:

------------------------------------------
1. a user logs on
2. the script checks if the user have more than... say 15Mb and if the user have that, then print a waring, saying:
"you have used X Mb of your total 25Mb".
3. if the user have less than 15Mb the logon works as normal.
4. if the user has more than 25Mb then there is a warning like this:
"You have used more than your 25Mb and the computer WILL shutdown. contact your administrator for help".
5. The computer reboots
-------------------------------------------

I don't know, but I think that this can be done by using a rewriten version of the "FindLargeFolders" funktion.

Or am I way of???

//Frippe

Top
#61232 - 2001-12-13 04:06 AM Re: Question about funktion "FindLargeFolders"
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

For other idea see our script du.kix, which is using a default
limitation of 25 MBytes.
greetings.

btw: symbol on our homepage has been linked to related http://kixtart.org topic.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#61233 - 2001-12-13 02:17 PM Re: Question about funktion "FindLargeFolders"
Anonymous
Unregistered


Thanks, but that "du.kix" is a little to complex for me......
(I'm rater new to kix)

If the "FindLargeFolder" function can be rewriten to return a TRUE/FALSE result then that would work perfect for me,
mostly because it's small/compact and since I'm going to run it at logon it has to be small.

Top
#61234 - 2001-12-14 08:38 PM Re: Question about funktion "FindLargeFolders"
Anonymous
Unregistered


Hi!

I think I have solved it!!

I have rewriten the FindLargeFolders funktion, af´ter ALOT of thinking
( "mum, my head hurts...." )

Now I have a quota-management at login for my users.

This is what I have done:
******************************************

;This is a rewrite of "Maarten's"
;"FindLargeFolders" function.
;
;
;
Function QuotaControl($path, optional $minimum,optional $indent)
dim $minsize,$subsize,$folder,$sub,$subs,$_indent,$Total
if vartype ($indent) = 8
$_indent = $indent
endif
$fso = createobject (Scripting.FileSystemObject)
if vartype($minimum) = 3
$minsize = $minimum
endif
$folder = $fso.getfolder($path)
$subs = $folder.subfolders
$_indent = $_indent + " "
for each $sub in $subs
if $sub.size
$subsize = (val($sub.size)) / 955000
$Total=$Total + $subsize
endif
FindLargeFolders($sub,$minsize,$_indent)
next
if (val($Total)) > (val($MinSize))
$Quota = "1"
$Quota_koll=$Total
else
$Quota = "0"
$Quota_koll=$Total
endif
Endfunction
return

********************************************

I have saved this as "Quota.udf"

In my main script i have this:
********************************************

;Call the "Quota"-function
Call (@LSERVER + "\Kix$\Quota.udf")

;Set users maximumsize in H:\ (Mb)
$QuotaSize=50

;Set a varning level for the users (Mb)
$Quotavarning=45

USE H: (@LSERVER + "\" + @USERID + "$")

QuotaControl("H:\",$QuotaSize)
IF Quota_koll > $Quotavarning
cls
? " Warning!! Warning!!"
? " "
? " You have now used $Quotavarning Mb of your space."
? " Remember that if you use more than $QuotaSize Mb,"
? " you will NOT be alowed to login"
Sleep 5
ENDIF
IF $Quota > 0
messagebox("You have use to much diskspace!, The computer will restart now.","@FULLNAME",16,5)
SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindows"
ENDIF

*******************************************
It seems to be working...
(I haven't put it to a "stress-test" yet)

What do you think??

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.054 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

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