Page 2 of 2

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

Posted: Thu Sep 29, 2016 10:39 am
by platforma
Just to give an update. The uos.statvfs() implementation has been merged in https://github.com/micropython/micropyt ... 5c2c95dd50

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

Posted: Thu Sep 29, 2016 8:40 pm
by mad474
Great! Thanks!

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

Posted: Wed Apr 18, 2018 3:30 pm
by DWiskow
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))

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

Posted: Sat Aug 07, 2021 5:15 pm
by ObiTwoKenobi
import uos, esp
blksize = uos.statvfs('/')[0]
fbs = uos.statvfs('/')[3]
print ("Avilable storage is:",(blksize*fbs)/1024, "KB", "out of:", esp.flash_size()/1024,"KB",sep=" ")