////// VERIFYING IF A FILE EXISTS //////|||COL|||2

I'm Developing a database aplication and need to VERIFY if a FILE EXISTES before assigning it to a TABLE component.

Can some one tell me how to verify a file existence ?


Thanks!


Bruno Maia





Comments

  • Hi, if I read your message correctly (becouse my

    English is not good)

    I suggest you make standart decision

    just use command FindFirst,FindNext.

    I send some example:


    procedure TForm1.SearchClick(Sender: TObject);


    begin

    FindFirst('c:Program Filesdelphi4in*.*', faAnyFile, SearchRec);

    Label1.Caption := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) + ' bytes in size';

    end;


    procedure TForm1.AgainClick(Sender: TObject);


    begin

    if (FindNext(SearchRec) = 0)

    Label1.Caption := SearchRec.Name + ' is ' + IntToStr(SearchRec.Size) + ' bytes in size';

    else

    FindClose(SearchRec);

    end;

    P.S. I get this Example from Delphi 4


  • : I'm Developing a database aplication and need to VERIFY if a FILE EXISTES before assigning it to a TABLE component.

    : Can some one tell me how to verify a file existence ?


    : Thanks!


    : Bruno Maia




    (from extdlg.pas)

    function ValidFile(const FileName: string): Boolean;

    begin

    Result := GetFileAttributes(PChar(FileName)) <> $FFFFFFFF;

    end;




    ValidPicture := FileExists(FullName) and ValidFile(FullName);




This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories