in reply to Filesize counting recursive

You probably don't even want to do this. The program du (disk usage) should be on your *nix box, and does this already, just call it from your program. See man du for more info.