On 4/8/23 9:38 PM, ikelaiah wrote:
// Get files in specified inputPath variable with a specific extension
     auto rmdFiles = file.dirEntries(inputPath, file.SpanMode.shallow)
         .filter!(f => f.isFile)
         .filter!(f => f.name.endsWith(fileEndsWith));

    // LINE 72 -- WARNING -- If we count the range here, later it will become 0 in line 82     writeln(programName ~ ": number of files found " ~ to!string(rmdFiles.walkLength));

dirEntries returns an *input range*, not a *forward range*. This means that once it's iterated, it's done.

If you want to iterate it twice, you'll have to construct it twice.

-Steve

Reply via email to