• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Oslib
        • File-types
        • Argv
        • Copy
        • Catpath
        • Universal-time
        • Ls
        • Basename
        • Tempfile
        • Dirname
        • Copy!
        • Mkdir
        • Ls-files
          • Ls-subdirs-aux
          • Ls-files-aux
        • Lisp-version
        • Rmtree
        • Ls-subdirs
        • Lisp-type
        • Date
        • Getpid
        • Basenames
        • Dirnames
        • Ls-subdirs!
        • Ls-files!
        • Dirname!
        • Basename!
        • Catpaths
        • Mkdir!
        • Ls!
        • Rmtree!
        • Remove-nonstrings
      • Std/io
      • Bridge
      • Clex
      • Tshell
      • Unsound-eval
      • Hacker
      • Startup-banner
      • Command-line
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • Oslib

Ls-files

Get a listing of only the regular files within a directory.

Signature
(ls-files path &key (state 'state)) → (mv error regular state)
Arguments
path — Directory whose files you want to list.
    Guard (stringp path).
Returns
error — NIL on success or an error msg on failure.
regular — On success: a list of names of files in path.
    Type (string-listp regular).
state — Type (state-p1 state), given (force (state-p1 state)).

The notion of regular file is governed by regular-file-p. It includes, for instance, symbolic links to regular files.

Definitions and Theorems

Function: ls-files-fn

(defun ls-files-fn (path state)
       (declare (xargs :stobjs (state)))
       (declare (xargs :guard (stringp path)))
       (let ((__function__ 'ls-files))
            (declare (ignorable __function__))
            (b* (((mv err all-files state) (ls path))
                 ((when err) (mv err nil state)))
                (ls-files-aux path all-files state))))

Theorem: string-listp-of-ls-files.regular

(defthm string-listp-of-ls-files.regular
        (b* (((mv common-lisp::?error
                  ?regular acl2::?state)
              (ls-files-fn path state)))
            (string-listp regular))
        :rule-classes :rewrite)

Theorem: state-p1-of-ls-files.state

(defthm state-p1-of-ls-files.state
        (implies (force (state-p1 state))
                 (b* (((mv common-lisp::?error
                           ?regular acl2::?state)
                       (ls-files-fn path state)))
                     (state-p1 state)))
        :rule-classes :rewrite)

Subtopics

Ls-subdirs-aux
Collect directories for ls-subdirs.
Ls-files-aux
Collect regular files for ls-files.