March 14, 2017 listdir | ||||
---|---|---|---|---|
| ||||
Hi, I'm trying to read all the txt files in specific path. I tried to use listdir function, but I get this error: Error: undefined identifier 'listdir' in module 'std.file' import std.stdio; import std.file; void main(string[] args) { auto vm_files = std.file.listdir("C:/Users/hadas/Documents/d", "*.txt"); foreach(d;vm_files) writeln(d); } |
March 14, 2017 Re: listdir | ||||
---|---|---|---|---|
| ||||
Posted in reply to hadas | There is no such function in D2 You can use dirEntries https://dlang.org/phobos/std_file.html#.dirEntries.2 Dne 14.3.2017 v 16:04 hadas via Digitalmars-d-learn napsal(a): > Hi, > I'm trying to read all the txt files in specific path. > I tried to use listdir function, but I get this error: > Error: undefined identifier 'listdir' in module 'std.file' > > > > > > import std.stdio; > import std.file; > > void main(string[] args) > { > > auto vm_files = std.file.listdir("C:/Users/hadas/Documents/d", "*.txt"); > > foreach(d;vm_files) > writeln(d); > > } > |
Copyright © 1999-2021 by the D Language Foundation