Main Site Documentation

Obtain free memory on SD card


Good afternoon Europe, goodmorning US,

Is there a method to obtain the number of total memory and the number of free memory on a SD card or USB pendrive?

Cu, Wim.


Try this:

static void RemovableMedia_Insert(object sender, MediaEventArgs e)
            Debug.Print("Total free: " +e.Volume.TotalFreeSpace);
            Debug.Print("Total size: " +e.Volume.TotalSize);


            long totalFreeSpace = DriveInfo.GetDrives()[0].TotalFreeSpace;
            long totalSize = DriveInfo.GetDrives()[0].TotalSize;

I hope it works.


Yes, thanks that is it.
Why didn’t I find that. :-[
Just needed the .NETMF part for a microSD card in a FEZ Domino.
But is is OK on a USB pendrive as well.

Cu, Wim.