Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vladimirmyshkovski/c846070fbafc62b17c028921ab021702 to your computer and use it in GitHub Desktop.
Save vladimirmyshkovski/c846070fbafc62b17c028921ab021702 to your computer and use it in GitHub Desktop.
find all files and get size in bytes, python
In [11]: import os
...: for root, dirs, files in os.walk('/var/www/gglobal/media/images/'):
...: for fn in files:
...: path = os.path.join(root, fn)
...: size = os.stat(path).st_size
...: print('{} {} bytes'.format(path.split('/')[-1], size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment