I am writing a Python script in Windows. I want to do something based on the file size. For example, if the size is greater than 0, I will send an email to somebody, otherwise continue to other things.
How do I check the file size?
Using os.path.getsize
:
>>> import os
>>> b = os.path.getsize("/path/isa_005.mp3")
>>> b
2071611
The output is in bytes.