Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all files in storage with Delphi XE5 Android App

How do I list files in SD card path and internal memory path?

I've tried FindFile with GetDocumentsPath as the parameter and i have no luck.

Ouch, where can I find more documentation or code snippets for Delphi for Android?

like image 391
alycia Avatar asked Oct 03 '22 22:10

alycia


1 Answers

Add System.IOUtils to your uses clause. You can then use code TPath and TDirectory something like this:

uses
  System.IOUtils, System.Types;

procedure TForm1.Button1Click(Sender: TObject);
var
  FileList: TStringDynArray;
  DocDir: string;
  s: string;
begin
  Memo1.Lines.Clear;
  DocDir := TPath.GetDocumentsPath;
  FileList := TDirectory.GetFiles(DocDir);
  for s in FileList do
    Memo1.Lines.Add(s);
end;
like image 96
Ken White Avatar answered Oct 13 '22 12:10

Ken White