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.

1 Like

Try this:
NETMF:

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

.NET

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

I hope it works.

1 Like

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.http://www.tinyclr.com/forum/reply/2/4264#