JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

os/dir

core-api


    cfunction
    src/core/os.c on line 2624, column 1

    (os/dir dir &opt arr)

    Enumerate files and subdirectories in a directory `dir`. Returns an 
    array of paths relative to `dir` with only the file or directory 
    name with no prefix. If an array `arr` is specified, append paths 
    to it instead of creating a new array.


2 examplesSign in to add an example
Loading...
# The optional array arg is used as the basis for the returned array

(os/dir "/tmp/dir_1" @["file_3" "file_4"]) # => @["file_3" "file_4" "file_1" "file_2"]
snltdPlayground
(os/dir "./")                   # => @[]
(os/shell "touch foo bar baz")  # => nil
(os/dir "./")                   # => @["foo" "bar" "baz"]
cellularmitosisPlayground