total_size = 0 #Показать сколько использованно места на флешке в Гигах и Мегабайтах for root, dirs, files in os.walk(usb_path): for f in files: tmp = os.path.join(root, f) total_size += os.path.getsize(tmp) print("General size of files", total_size // 1024 // 1024 // 1024, "GB") print("General size of files", total_size // 1024 // 1024, "MB")