Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(def x ((comp file-seq clojure.java.io/file) d))
auto directory_contents(auto path) {
auto iterator = std::filesystem::directory_iterator(path);
return std::vector<std::filesystem::path>(
std::ranges::begin(iterator),
std::ranges::end(iterator)
);
}
auto main(int argc, char** argv) -> int {
auto path = argc >= 2
? std::filesystem::path(argv[1])
: std::filesystem::current_path();
for (auto entry : directory_contents(path)) {
std::cout << entry.string() << std::endl;
}
}
$x = scandir($d);
opendir my $dh, $d or die "Could not open $d for reading: $!\n";
@x = readdir $dh;
closedir $dh;
x = Dir.children(d)
let x = std::fs::read_dir(d)?.collect::<Result<Vec<_>, _>>()?;
let x = std::fs::read_dir(d).unwrap();