Walk a directory/Recursively: Difference between revisions
Content added Content deleted
m (→{{header|Ruby}}: use lang tag) |
No edit summary |
||
Line 292: | Line 292: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|Mathematica}}== |
|||
The built-in function FileNames does exactly this: |
|||
<lang Mathematica> |
|||
FileNames[] lists all files in the current working directory. |
|||
FileNames[form] lists all files in the current working directory whose names match the string pattern form. |
|||
FileNames[{form1,form2,...}] lists all files whose names match any of the form_i. |
|||
FileNames[forms,{dir1,dir2,...}] lists files with names matching forms in any of the directories dir_i. |
|||
FileNames[forms,dirs,n] includes files that are in subdirectories up to n levels down. |
|||
</lang> |
|||
Examples (find all files in current directory, find all png files in root directory, find all files on the hard drive): |
|||
<lang Mathematica> |
|||
FileNames["*"] |
|||
FileNames["*.png", $RootDirectory] |
|||
FileNames["*", {"*"}, Infinity] |
|||
</lang> |
|||
the result can be printed with Print /@ FileNames[....] |
|||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |