Securely deleting a file in C#.NET

前端 未结 5 2124
无人及你
无人及你 2021-02-10 01:29

In a project I am doing I want to give users the option of \'securely\' deleting a file - as in, overwriting it with random bits or 0\'s. Is there an easy-ish way of doing this

5条回答
  •  不要未来只要你来
    2021-02-10 01:37

    You could invoke sysinternals SDelete to do this for you. This uses the defragmentation API to handle all those tricky edge cases.

    Using the defragmentation API, SDelete can determine precisely which clusters on a disk are occupied by data belonging to compressed, sparse and encrypted files.

    If you want to repackage that logic in a more convenient form, the API is described here.

提交回复
热议问题