python libs
This commit is contained in:
12
bin/lib/misc.py
Normal file
12
bin/lib/misc.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
def get_disk_size(path):
|
||||
total_size = 0
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
for f in filenames:
|
||||
fp = os.path.join(dirpath, f)
|
||||
# skip if it is symbolic link
|
||||
if not os.path.islink(fp):
|
||||
total_size += os.path.getsize(fp)
|
||||
|
||||
return total_size
|
||||
Reference in New Issue
Block a user