How to get free space of internal file system?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: How to get free space of internal file system?

Post by platforma » Thu Sep 29, 2016 10:39 am

Just to give an update. The uos.statvfs() implementation has been merged in https://github.com/micropython/micropyt ... 5c2c95dd50

mad474
Posts: 60
Joined: Sun Dec 29, 2013 7:48 pm

Re: How to get free space of internal file system?

Post by mad474 » Thu Sep 29, 2016 8:40 pm

Great! Thanks!

DWiskow
Posts: 6
Joined: Sun Apr 24, 2016 1:23 pm

Re: How to get free space of internal file system?

Post by DWiskow » Wed Apr 18, 2018 3:30 pm

This would do it . . .

Code: Select all

import uos
fs_stat = uos.statvfs('/')
fs_size = fs_stat[0] * fs_stat[2]
fs_free = fs_stat[0] * fs_stat[3]
print("File System Size {:,} - Free Space {:,}".format(fs_size, fs_free))

Post Reply