Answers for "print file size linux"

16

list file size as mb

ls -l --block-size=M
Posted by: Guest on May-28-2020
3

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')
Posted by: Guest on April-17-2020
6

linux file size

cd dir ; du -hsx * | sort -rh | head -20 
# example output
# 300MB    some_backup_file.log
# 1.8GB    some_huge_file.war
Posted by: Guest on August-11-2020
3

linux command for file size

#Get file size of each folder
du -bsh *
Posted by: Guest on April-26-2020

Python Answers by Framework

Browse Popular Code Answers by Language