Gostou do artigo e quer me ajudar? então clique em uma das propagandas ao lado!!
terça-feira, 5 de junho de 2012
Delphi - Renomear arquivos utilizando o Find First Find Next
procedure TForm1.BitBtn1Click(Sender: TObject);
var
SearchRec:TSearchRec;
Result:Integer;
strFinal, strFinal2, Path: string;
begin
Path := 'C:\caminho\exemplo\';
Result:=FindFirst(Path +'*.xml*', faAnyFile, SearchRec);
while Result=0 do
begin
strFinal := (copy(SearchRec.Name,0,pos('-',SearchRec.Name))) + '.pdf';
strFinal2 := StringReplace(StrFinal,'-','',[rfReplaceAll]);
RenameFile(Path+SearchRec.Name, Path+strFinal2);
Result:=FindNext(SearchRec);
end;
end;
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário