Well, it can't be done in PHP, coz if someone were to request an HTML page, it wouldn't have to go through PHP, so PHP wouldn't know that the bandwidth was used....I think it has to be done at the web server level...
Or maybe you can use PHP to parse to web server's log file. You check for the entries that belong to the dir you're looking at, and sum the content lengths. But then with this you're only counting the bandwidth used by the web server. If you have a multimedia web server, or a database server, then you'd have to count all those too...
Diego