www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - listdir

reply hadas <hadasnadav2 gmail.com> writes:
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);

}
Mar 14
parent Daniel Kozak via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
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);

 }
Mar 14