What's the most efficient way to delete a file if it's less than 100k?
file = '/path/to/file.mov'
You can use os.path.getsize (returns file size in bytes) and os.remove like that:
import os
file = '/path/to/file.mov'
if os.path.getsize(file) < 100 * 1024:
os.remove(file)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With