=={{header|LiveCode}}==
<lang LiveCode>function recurDirpathsForPatternAndDirectory dirpPattern, extpDirectory
set the defaultFolder to dir pDirectory
repeat for each line fi in the files ▼
filter the files with pPattern
if fileExt(fi) = ext then
▲ repeat for each line fitFile in the filesit
put the longfilepath of fi & cr after fileList
put recurDir((dirpDirectory & slash & di), ext) tFile & cr after fileListtPaths▼
end if
end repeat
repeat for each line di in the folders ▼
filter the folders without ".."
if di is not "." and di is not ".." then
▲ repeat for each line ditFolder in the foldersit
▲ put recurDir((dir & slash & di), ext) & cr after fileList
put pathsForPatternAndDirectory(pPattern, pDirectory & slash & tFolder) after tPaths
end if
end repeat
filter fileList without empty
return fileListtPaths
end pathsForPatternAndDirectory
end recurDir
function fileExt f
set the itemdel to "."
return the last item of f
end fileExt</lang>
Example
<lang LiveCode>put recurDir(the home folder & slash & "music", "mp3")</lang>
Output
<pre>... /Users/xxx/music/albumx/trackx.mp3
/Users/xxx/music/albumx/trackx2.mp3
/Users/xxx/music/albumy/tracky.mp3 ...</pre>
=={{header|Lua}}==
|