Walk a directory/Non-recursively: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: modified the code to work with the latest version of Sidef) |
|||
Line 831: | Line 831: | ||
The <code>dir</code> function takes the directory to traverse, and optionally a named parameter <code>test</code>, which can for example be a regex: |
The <code>dir</code> function takes the directory to traverse, and optionally a named parameter <code>test</code>, which can for example be a regex: |
||
<lang perl6>.say for dir(".", :test(/foo/))</lang> |
<lang perl6>.say for dir(".", :test(/foo/))</lang> |
||
=={{header|Phix}}== |
|||
The dir function accepts a DOS pattern, with some minor variations (eg "*" gets all files with no extension). |
|||
<lang Phix>puts(1,join(columnize(dir("*.txt"))[D_NAME],"\n"))</lang> |
|||
{{out}} |
|||
<pre> |
|||
copyright.txt |
|||
e-1millon.txt |
|||
ildump.txt |
|||
output.txt |
|||
readme.txt |
|||
_TODO.TXT |
|||
</pre> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |