Walk a directory/Recursively: Difference between revisions
Content added Content deleted
(Updated BFS search to be platform agnostic (should work on windows)) |
|||
Line 1,312: | Line 1,312: | ||
=={{header|R}}== |
=={{header|R}}== |
||
<lang R>dir("/bar/foo", "mp3",recursive=T)</lang> |
<lang R>dir("/bar/foo", "mp3",recursive=T)</lang> |
||
=={{header|REALbasic}}== |
|||
<lang vb> |
|||
Sub printFiles(parentDir As FolderItem, pattern As String) |
|||
For i As Integer = 1 To parentDir.Count |
|||
If parentDir.Item(i).Directory Then |
|||
printFiles(parentDir.Item(i), pattern) |
|||
Else |
|||
Dim rg as New RegEx |
|||
Dim myMatch as RegExMatch |
|||
rg.SearchPattern = pattern |
|||
myMatch = rg.search(parentDir.Item(i).Name) |
|||
If myMatch <> Nil Then Print(parentDir.Item(i).AbsolutePath) |
|||
End If |
|||
Next |
|||
End Sub |
|||
</lang> |
|||
Accepts a FolderItem object and a Regex pattern as a string: |
|||
<lang vb> |
|||
Dim f As FolderItem = GetFolderItem("C:\Windows\system32") |
|||
Dim pattern As String = "((?:[a-z][a-z]+))(\.)(dll)" //all file names ending in .dll |
|||
printFiles(f, pattern)</lang> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |