Skip to content

Instantly share code, notes, and snippets.

@jouellnyc
Created June 13, 2024 02:20
Show Gist options
  • Save jouellnyc/b11833c07371a8986439e3c50b2e7861 to your computer and use it in GitHub Desktop.
Save jouellnyc/b11833c07371a8986439e3c50b2e7861 to your computer and use it in GitHub Desktop.
How to get free space of internal file system - micropython
# Credit https://forum.micropython.org/viewtopic.php?f=16&t=2361&start=10
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment