Walk a directory/Recursively: Difference between revisions

(→‎{{header|Julia}}: updated to Julia 1.2)
Line 635:
if (regex_match(name, pattern))
std::cout << iter->path() << "\n";
}
}</lang>
 
{{libheader|std|C++17}}
<lang cpp>
#include <filesystem>
#include <iostream>
 
namespace fs = std::filesystem;
 
int main() {
fs::path current_dir(".");
// list all files containing an mp3 extension
for (auto &file : fs::recursive_directory_iterator(current_dir)) {
if (file.path().extension() == ".mp3")
std::cout << file.path().filename().string() << std::endl;
}
}</lang>
Anonymous user