Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 팁&트릭
Delphi Programming Tip&Tricks
[25] 특정 디렉토리의 파일들 검색하기
장인수 [textout] 5869 읽음    2002-09-09 03:06
FindFiles.zip 233.6KB 소스,실행파일
unit Unit1; 

interface 

uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, Grids; 

type 
  TForm1 = class(TForm) 
    Button1: TButton; 
    GList: TStringGrid; 
    Edit1: TEdit; 
    procedure Button1Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 

var 
  Form1: TForm1; 
  SearchRec: TSearchRec; 
implementation 

{$R *.dfm} 

procedure TForm1.Button1Click(Sender: TObject); 
var 
  i: integer; 
begin 
  GList.Cells[0,0] := '파일명'; 
  GList.Cells[1,0] := '크기'; 
  GList.Cells[2,0] := '종류'; 

  i := 0; 
  if FindFirst(Edit1.Text, faAnyFile, SearchRec) = 0 then 
  begin 
    repeat 
      Inc(i); 
      GList.Cells[0,i] := SearchRec.Name; 
      GList.Cells[1,i] := IntToStr(SearchRec.Size); 
      case SearchRec.Attr of 
        $00000001: GList.Cells[2,i] := 'Read-only files'; 
        $00000002: GList.Cells[2,i] := 'Hidden files'; 
        $00000004: GList.Cells[2,i] := 'System files'; 
        $00000008: GList.Cells[2,i] := 'Volume ID files'; 
        $00000010: GList.Cells[2,i] := 'Directory files'; 
        $00000020: GList.Cells[2,i] := 'Archive files'; 
        $0000003F: GList.Cells[2,i] := 'Any file'; 
      end; 

      GList.RowCount := i+1; 
    until FindNext(SearchRec) <> 0; 
  end 
  else ShowMessage('파일이 없습니다'); 

  FindClose(SearchRec); 
end; 

end. 

+ -

관련 글 리스트
25 특정 디렉토리의 파일들 검색하기 장인수 5869 2002/09/09
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.