Main Site Documentation

Trouble deleting a file on a SD card


I am having trouble deleting a file on a SD card with the ChipWorkX development system. I check for the specific file and if it exists then I try to delete it. I just get an

“An unhandled exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll” error every time.

If I delete the file from my PC, I can successfully create a new file and save xml to it with the ChipWorkX. So if I detect the file I want to remove it and create a new one. I can successful determine if it exists, but I can’t delete it. Below is the line of code.



Maybe the SD files are corrupted already? I tried the following and it works fine here. Please try it:
-format the SD card on Windows
-put a test file on it
-make sure ChipwrokX has the latest firmware from online SDK
-try this program which deletes the file

GHIElectronics.NETMF.IO.PersistentStorage sd = new GHIElectronics.NETMF.IO.PersistentStorage("SD");

if (File.Exists("\\SD\\test.test"))



thanks for your help Mike. I was being careless and forget to close the xmlreader that read the file on startup. Apologies for wasting your time.


no problem