Secure delete with python

Benjamin Niemann b.niemann at betternet.de
Mon Sep 6 15:30:12 CEST 2004


Benjamin Niemann wrote:

> Boris Genc wrote:
> 
>> Hi everybody.
>> I was wandering is there a method or a function already implemented in
>> python that supports secure deletion of data?
>>
>> I'm interested in something which is able to securely wipe data (from
>> single file to bunch of MB's), and that should run both on Linux and
>> Windows.
>>
>> I tried on google, but I hadn't found anything useful to me.
>>
>> Thank you very much in advance.
>>
>> Boris Genc
> 
> something like
> 
> fp = open(path, "wb")
> for i in range(os.path.getsize(path)):
>     fp.write("*")
> fp.close()
> os.unlink(path)

and there is no guarantee that this actually overwrites the old file. The 
filesystem may choose to write the new content at another location of the disk, 
leaving the original data untouched.



More information about the Python-list mailing list