Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to get size of folder python

import os

def get_size(start_path = '.'):
    total_size = 0
    for dirpath, dirnames, filenames in os.walk(start_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

print(get_size(), 'bytes')
Comment

PREVIOUS NEXT
Code Example
Python :: python tkinter underline text 
Python :: python color in console 
Python :: get python script path 
Python :: plot nan values sns 
Python :: python 3 pm2 
Python :: Package python3-pip is not available, but is referred to by another package. 
Python :: How to increase text size tkinter 
Python :: reverse row order pandas 
Python :: remove outliers python pandas 
Python :: python get filename from path 
Python :: Update all packages using pip on Windows 
Python :: pandas add suffix to column names 
Python :: export pandas dataframe as excel 
Python :: selenium python enter text 
Python :: label encoder python 
Python :: time start python 
Python :: 2d list comprehension python 
Python :: join video moviepy 
Python :: how to find the most frequent value in a column in pandas dataframe 
Python :: Python - How to check if string is a HEX Color Code 
Python :: python check if a variable is an pandaDataframe 
Python :: python 2 decimal places 
Python :: run celery on windows 
Python :: dictionary with numbers python 
Python :: sklearn random forest regressor 
Python :: pandas select rows with values in a list 
Python :: how to get a random element from an array in python 
Python :: hbox(children=(floatprogress(value= 
Python :: read database pandas 
Python :: pandas convert to 2 digits decimal 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =