Martin Bodocky
Martin Bodocky

Reputation: 691

How to delete DETS file?

I'm having problem with DETS file, I cannot find functionality how to complete delete DETS file from my drive. Let's demonstrate scenario, you create DETS file insert one element and then you want to destroy that file as temporary but persistent storage.

dets:open_file("TestFile",[{file, "TestFile.db"}]).
{ok,"TestFile"}
dets:insert("TestFile", {a,b,c}).
ok
dets:delete_all_objects("TestFile").
ok
dets:info("TestFile").
[{type,set},
{keypos,1},
{size,0},
{file_size,5432},
{filename,"TestFile.db"}]

How can I delete file "TestFile.db" ?

Upvotes: 2

Views: 506

Answers (1)

RichardC
RichardC

Reputation: 10557

There's no function in the dets module for deleting the file itself. Just call file:delete("TestFile.db").

Upvotes: 7

Related Questions