JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

os/stat

core-api


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

    
3 examplesSign in to add an example
Loading...
(defn recent-mods
  "List the files in the current directory which have changed within the last hour."
  []
  (filter
    (fn [fname]
      (<
        (- (os/time) 3600)
        (os/stat fname :modified)))
    (os/dir ".")))
cellularmitosisPlayground
(defn ls-sockets
  "List the sockets in the current directory."
  []
  (filter
    (fn [fname] (= :socket (os/stat fname :mode)))
    (os/dir ".")))
cellularmitosisPlayground
(os/shell "touch foo")
(os/stat "foo" :modified)  # => 1593836002
(os/touch "foo")
(os/stat "foo" :modified)  # => 1593836013
cellularmitosisPlayground