This language bar is your friend. Select your favorite languages!

Idiom #180 List files in directory

Create list x containing the contents of directory d.

x may contain files and subfolders.
No recursive subfolder listing.

SysUtils, Classes
  if FindFirst(IncludeTrailingPathDelimiter(d) + '*', 
               faAnyFile and (not faDirectory), SR) = 0 then
  repeat
    x.Add(SR.Name);
  until FindNext(SR) <> 0;
  FindClose(SR);
FileUtil
x := FindAllFiles(d, '*', False);
import "io/ioutil"
x, err := ioutil.ReadDir(d)
x = Dir.children(d)

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org