Walk a directory/Recursively: Difference between revisions
Content added Content deleted
Barbaneigro (talk | contribs) No edit summary |
Barbaneigro (talk | contribs) m (→{{header|Dart}}: Further identify dir/file to better perform action) |
||
Line 794: | Line 794: | ||
void main(List<String> args) { |
void main(List<String> args) { |
||
var dir = Directory(args[0]); |
var dir = Directory(args[0]); |
||
dir.list(recursive: true, followLinks: false).forEach( |
dir.list(recursive: true, followLinks: false).forEach((final cur) { |
||
if (cur is Directory) { |
|||
// perform any action on files/dirs |
|||
print("Directory: ${cur.path}"); |
|||
} |
|||
if (cur is File) { |
|||
print("File: ${cur.path}"); |
|||
} |
|||
}); |
|||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |