| [reply] |
Norton used to make a utility for doing what you want for FAT drives.
DWIM is Perl's answer to Gödel
| [reply] |
Here's some untested code for you. The intention is to first figure out how much crap we need to overwrite the file with, then open the file in read/write mode - this avoids clobbering the file and creating a new one which would happen if we just opened the file for writing, and also means that we can get at the beginning of the file unlike if we opened it for appending. Then it just overwrites the file with 'X's. Finally, it closes the file and unlinks it.
This will certainly protect you from "undelete" on DOS (all it will undelete is a file of 'X's) and DOS-a-likes such as Win95, and probably on WinNT and its successors if using the FAT filesystem. My understanding of ext2 leads me to believe that it should also protect you on most Linux systems. But I can't be sure that it will work anywhere else, including on Linux systems using stuff like Reiserfs, and as other people have pointed out, it certainly won't protect you against The Man. And even that paper is now out of date.
my $bytes = -s $filename
open(FILE, '+<', $filename);
seek(FILE, 0, 0);
print FILE "X" x $bytes;
close(FILE);
unlink $filename;
| [reply] [d/l] |
| [reply] |
"commercially available 'undelete'" sounds like you don't mean to consider even marginally clever adversaries.
In this case, truncating the file may all you need, with copying something innocent (a random configuration or help file from a windows system directory) or such as a safer second choice.
'undelete' normally only covers *deletion*, right? | [reply] |