Handbook
Glossary
find-files-by-extension ( path extension -- seq )
Factor handbook
»
Input and output
»
Directory manipulation
»
Searching directories
Prev:
find-files-in-directories ( directories quot: ( ... name -- ... ? ) -- paths/f )
Next:
find-files-by-extensions ( path extensions -- seq )
Vocabulary
io
.
directories
Inputs
path
a pathname string
extension
a file extension
Outputs
seq
a
sequence
Word description
Searches a directory for all files with the given extension. File extension and filenames are converted to lower-case and compared using the
tail?
word. The file extension should contain the period.
Examples
USING: io.directories ; "/" ".mp3" find-by-extension
Definition
USING:
arrays
;
IN:
io.directories
:
find-files-by-extension
( path extension -- seq )
1array
find-files-by-extensions
;