System.IO.Directory.GetFilesメソッドで簡単に取得できます。
以下、サンプル
- method MainForm.buttonExecGetFile_Click(sender: System.Object; e: System.EventArgs);
- var
- FileList : Array of String;
- FileName : String;
- begin
- Self.listBoxResult.Items.Clear();
- if Self.checkBoxFindSubDir.Checked then
- begin
- FileList := System.IO.Directory.GetFiles(Self.textBoxStartPath.Text,'*',System.IO.SearchOption.AllDirectories);
- end
- else
- begin
- FileList := System.IO.Directory.GetFiles(Self.textBoxStartPath.Text,'*',System.IO.SearchOption.TopDirectoryOnly);
- end;
- For FileName in FileList do
- begin
- listBoxResult.Items.Add(FileName);
- end;
- end;
0 件のコメント:
コメントを投稿