Walk a directory/Recursively: Difference between revisions

Content added Content deleted
No edit summary
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
(x) => print(x),
print("Directory: ${cur.path}");
);
}

if (cur is File) {
print("File: ${cur.path}");
}
});
}
}
</syntaxhighlight>
</syntaxhighlight>