S3 does not have a concept of "folders", the console only presents the data like folders in the console by splitting object keys on the forward slash ("/"). So summarizing data by "folder" would require parsing the key of each object.
You could pull ALL of the data for objects that match your key prefix and then perform some logic & math to sum it together, but that is a lot of work.
If you don't need the data in real-time, S3 Inventory may provide a good solution. Basically you get a list of the objects in the specified S3 bucket output in one of three formats: CSV, Apache ORC or Apache Parquet.
You can then do much easier computations based on the data.
The downside to S3 Inventory is that it takes a day or so to get the report and it is not real-time.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html
--
If you are looking at an easier way to manage costs you may want to break the use case up using one S3 bucket for each. Then you could utilize Cost Allocation Tags at the Bucket level.
Also S3 utilization reporting is helpful for determining if you should be using a different storage class.