Unix/ls: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 74:
end loop;
end Directory_List;</lang>
=={{header|Aime}}==
Line 226 ⟶ 225:
</lang>
=={{header|C++}}==▼
{{libheader|Boost}}▼
<lang cpp>▼
#include <iostream>▼
#include <set>▼
#include <boost/filesystem.hpp>▼
namespace fs = boost::filesystem;▼
int main(void)▼
{▼
fs::path p(fs::current_path());▼
std::set<std::string> tree;▼
for (auto it = fs::directory_iterator(p); it != fs::directory_iterator(); ++it)▼
tree.insert(it->path().filename().native());▼
for (auto entry : tree)▼
std::cout << entry << '\n';▼
}▼
</lang>▼
=={{header|C sharp|C#}}==
<lang csharp>using System;
Line 273 ⟶ 251:
}
}</lang>
▲=={{header|C++}}==
▲{{libheader|Boost}}
▲<lang cpp>
▲#include <iostream>
▲#include <set>
▲#include <boost/filesystem.hpp>
▲namespace fs = boost::filesystem;
▲int main(void)
▲{
▲ fs::path p(fs::current_path());
▲ std::set<std::string> tree;
▲ for (auto it = fs::directory_iterator(p); it != fs::directory_iterator(); ++it)
▲ tree.insert(it->path().filename().native());
▲ for (auto entry : tree)
▲ std::cout << entry << '\n';
▲}
▲</lang>
=={{header|Clojure}}==
Line 696:
END.
</lang>
=={{header|Perl}}==
Line 708 ⟶ 709:
<lang perl>print "$_\n" for glob '* .*'; # If you want to include dot files</lang>
=={{header|Perl 6}}==▼
There is a <tt>dir</tt> builtin command which returns a list of IO::Path objects. We stringify them all with a hyperoperator before sorting the strings.▼
<lang perl6>.say for sort ~«dir</lang>▼
=={{header|Phix}}==
Line 812 ⟶ 807:
Both tests pass.
(formerly Perl 6)
▲There is a <tt>dir</tt> builtin command which returns a list of IO::Path objects. We stringify them all with a hyperoperator before sorting the strings.
▲<lang perl6>.say for sort ~«dir</lang>
=={{header|REXX}}==
Line 827 ⟶ 829:
</lang>
This will output all files including hidden ones e.g. '.' and '..'.
=={{header|Run BASIC}}==
<lang Runbasic>files #f, DefaultDir$ + "\*.*" ' RunBasic Default directory.. Can be any directroy
Line 900 ⟶ 903:
b
</pre>
=={{header|S-lang}}==
Line 935 ⟶ 937:
/usr
/var </pre>
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
|