How to get free memory on MemoryCard

  • Thread starter Thread starter R.Scharf
  • Start date Start date
R

R.Scharf

Hello NG

I Can't find the way to get the free Memory on my MemoryCard (\SD-Card)

I use the Card to save Log and backup files. Bevor i'm start to copy files
to the card i will know if there is enough free space.

Greetings from Germany
René
 
You can but you'll need to resort to a bit of P/Invoke. In C#:-

[System.Runtime.InteropServices.DllImport("coredll.dll", SetLastError =
true)]
private static extern bool GetDiskFreeSpaceEx(string directoryName, out long
freeBytesAvailable, out long totalBytes, out long totalFreeBytes);

Then call the function like so:-

long freeBytesAvailable, totalBytes, totalBytesFree;
bool success = GetDiskFreeSpaceEx("\\SD-Card",out freeBytesAvailable, out
totalBytes, out totalFreeBytes);

Peter
 
Back
Top