[REBOL] optimising recursion?
From: petr:krenzelok:trz:cz at: 20-Mar-2002 11:15
Hi,
is my function conceptually wrong? It fails on very large network
directory ....
REBOL []
dir-size?: func [path [file!] /local dir-list total tmp][
total: 0
if not dir? path [return none] ; wrong param to func ...
dir-list: read path
if empty? dir-list [return 0] ;take care of empty dir
foreach item dir-list [
either (last to-string item) = #"/" [
tmp: dir-size? append copy path item
total: total + tmp
][
s: size? append copy path item
if not none? s [total: total + s] ; take care
of possibly locked file ....
]
]
total
]
->> ble: dir-size? %/g/control/
** Math Error: Math or number overflow
** Where: dir-size?
** Near: total: total + tmp
I haven't found dir-utils in the library, so I quickly hacked my own
solution, but maybe I am missing something ....
Thanks a lot,
-pekr-