How to get file system free space size in Micropython?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

How to get file system free space size in Micropython?

Post by water » Thu Oct 05, 2017 3:09 pm

Thanks.

cv007
Posts: 1
Joined: Thu Oct 05, 2017 5:46 pm

Re: How to get file system free space size in Micropython?

Post by cv007 » Thu Oct 05, 2017 5:56 pm

https://docs.micropython.org/en/latest/ ... y/uos.html

>>>import uos
>>> uos.statvfs('/')
(4096, 4096, 348, 329, 329, 0, 0, 0, 0, 255)

so,
4096 * 348 is total space in bytes
4096 * 329 is free space in bytes
used space = total - free

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: How to get file system free space size in Micropython?

Post by water » Fri Oct 06, 2017 7:32 pm

cv007 wrote:https://docs.micropython.org/en/latest/ ... y/uos.html

>>>import uos
>>> uos.statvfs('/')
(4096, 4096, 348, 329, 329, 0, 0, 0, 0, 255)

so,
4096 * 348 is total space in bytes
4096 * 329 is free space in bytes
used space = total - free
Thanks.

Post Reply