



A função retorna verdadeiro se o arquivo existir.
É necessário estar declarado SysUtils na seção uses,
em versões unicode declare System.SysUtils;
Função do Delphi: FileExists(caminho da pasta);
Retorno: Boolean.
Exemplos de uso.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | procedure TForm1.Button1Click(Sender: TObject); begin // Testando um arquivo existente. if FileExists('C:\windows\notepad.exe') then ShowMessage('O arquivo existe.') else ShowMessage('O arquivo não existe.'); // Testando com uma arquivo que não existe. if FileExists('X:\teste\teste.txt') then ShowMessage('O arquivo existe.') else ShowMessage('O arquivo não existe.'); end; |