Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

CIRCUITPYTHON: How to get free space on SD card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CIRCUITPYTHON: How to get free space on SD card

by digixx on Sun Apr 05, 2020 5:18 pm

Hi,

How to estimate free space on an SD card? ( I use the adafruit_sdcard.py)
I want to check the free space on card on startup and maybe run some cleanup.

This project is a GPS data logger used on a sailboat in the sea. Because Circuitpython can be updated via USB-filestore, its a very elegant way to update source by sending it via email to the user who saves it to the controller storage. No programmer hardware needed.

digixx
 
Posts: 2
Joined: Fri Jan 17, 2020 4:44 pm

Re: CIRCUITPYTHON: How to get free space on SD card

by jerryn on Sun Apr 05, 2020 10:44 pm

Use os.statvfs
https://circuitpython.readthedocs.io/en/latest/shared-bindings/os/__init__.html#os.statvfs
Code: Select all | TOGGLE FULL SIZE
import os
os.statvfs(“sd/“)
assuming you’ve mounted the SD card as sd

jerryn
 
Posts: 1251
Joined: Sat Sep 14, 2013 9:05 am

Please be positive and constructive with your questions and comments.