Using os.path.getsize()
will only result in the size of the directory, NOT its contents. Therefore, if you call getsize()
in any directory, you will always be the same size, since they are all represented the same way. Otherwise, if you call it in a file, it will return the actual file size.
If you need content that you will need to do recursively, for example below:
sum([os.path.getsize(f) for f in os.listdir('.') if os.path.isfile(f)])
source share