procedure ShredderFile(FileName: string);
const
Buffer = 1024;
Counttowrite = 34;
FillBuffer: array[0..5] of Integer = ($00, $FF, $00, $F0, $0F, $00);
var
arr: array[1..Buffer] of Byte;
f: file;
i, j, n: Integer;
begin
AssignFile(f, FileName);
Reset(f, 1);
n := FileSize(f);
for j := 0 to Counttowrite do
begin
for i := 1 to n div Buffer do
begin
BlockWrite(f, FillBuffer[j], Buffer);
end;
end;
CloseFile(f);
RenameFile(FileName, ExtractFilepath(FileName) + '$000000.tmp');
DeleteFile(ExtractFilepath(FileName) + '$000000.tmp');
end;
procedure ShredderAndDeleteFile(const FileName: string);
var
newname: string;
begin
// zuerst umbennen, dann später keine Rückschlüsse auf den Dateinamen möglich sind
// first rename the file
newname := ExtractFilepath(FileName) + '$000000.tmp';
if not RenameFile(FileName, newname) then
raise
Exception.CreateFmt('Fehlercode 2: Kann %s nicht umbenennen!', [FileName]);
ShredderFile(newname);
DeleteFile(newname);
end;
// Aufruf / Call: ShredderAndDeleteFile(Edit1.Text)
Bewerten Sie diesen Tipp:
|
|
|