How to check size of the files in a directory with python?
Question: I have a folder that contains 4 text files. I want to program a code with
which I would be able to check the size of the files in my folder and only
open those that has equal sizes. Anyone has any idea?

I have already tried this

    
    
    import os
    
    
    d=os.stat('H:/My Documents/211').st_size
    


Answer: I can't reproduce your error. This

    
    
    import os
    print os.path.getsize('mydata.csv')
    print os.stat('mydata.csv').st_size
    

Yields

    
    
    359415
    359415
    

I'm guessing that the filename you provide is wrong. This will print the size
of all files in a folder

    
    
    my_dir = r'path/to/subdir/'
    
    for f in os.listdir(my_dir):
        path = os.path.join(my_dir, f)
        if os.path.isfile(path):
            print os.path.getsize(path)
    

