Dart: List directory recursively (tree, ls) ls(String where, [String prefix]) { if(prefix == null) { prefix = ''; } var dir = new Directory(where); print(where); List contents = dir.listSync(); for (var fileOrDir in contents) { if (fileOrDir is File) { print(fileOrDir.path); } else if (fileOrDir is Directory) { print(fileOrDir.path); ls(fileOrDir.path, prefix + '-'); } } }
"If you think without writing, you only think you're thinking." - Leslie Lamport | Contents are snapshots of thoughts; they change within minutes.