View/Edit #3152:file_stat

Switch to edit mode.

Name(s): file_stat
1:  "How much of the MOO is full of files?"
2:  !caller_perms():isa($guardian) || raise(E_PERM)
3:  read_size = total_size = 0
4:  for x in [#1..max_object()]
5:    ticks_left() > 2000 || suspend(0)
6:    for y in (`x:filelist() ! ANY => {}')
7:      if (!x:fileaccess(y))
8:        total_size = total_size + x:file_size(y)
9:      else
10:       read_size = read_size + x:file_size(y)
11:     endif
12:     ticks_left() > 2000 || suspend(0)
13:   endfor
14: endfor
15: percentage = $math_utils:round(tofloat(read_size) / tofloat(total_size) * 100.0)
16: return tostr("Only ", $math_utils:round(tofloat(read_size) / 1048576.0), "Mb / ", $math_utils:round(tofloat(total_size) / 1048576.0), "Mb (", percentage, "%) of MOO files are avaliable for file grepping by $programmers!")

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Anon (#3152)

You are not logged in.

[home | help | who | search | setup | code]