python - Get file size during os.walk -


i using os.walk compare 2 folders, , see if contain exact same files. however, checks file names. want ensure file sizes same, , if they're different report back. can file size os.walk?

the same way file size without using os.walk, os.stat. need remember join root:

for root, dirs, files in os.walk(some_directory):     fn in files:         path = os.path.join(root, fn)         size = os.stat(path).st_size # in bytes          # ... 

Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

php - Time zone issue -

iphone - Using nested NSDictionary with Picker -