JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

os/dir

core-api


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

    (os/dir dir &opt array)

    Iterate over files and subdirectories in a directory. Returns an 
    array of paths parts, with only the file name or directory name and 
    no prefix.


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