• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
        • Io
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Std/io
        • Oslib
          • File-types
          • Argv
          • Copy
          • Catpath
          • Ls
          • Universal-time
          • Tempfile
          • Basename
          • Dirname
          • Copy!
          • Ls-files
            • Ls-subdirs-aux
            • Ls-files-aux
          • Mkdir
          • Rmtree
          • Lisp-version
          • Lisp-type
          • Ls-subdirs
          • Date
          • Getpid
          • Dirnames
          • Basenames
          • Basename!
          • Ls-subdirs!
          • Ls-files!
          • Dirname!
          • Ls!
          • Catpaths
          • Mkdir!
          • Rmtree!
          • Remove-nonstrings
        • Bridge
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
        • File-types
        • Argv
        • Copy
        • Catpath
        • Ls
        • Universal-time
        • Tempfile
        • Basename
        • Dirname
        • Copy!
        • Ls-files
          • Ls-subdirs-aux
          • Ls-files-aux
        • Mkdir
        • Rmtree
        • Lisp-version
        • Lisp-type
        • Ls-subdirs
        • Date
        • Getpid
        • Dirnames
        • Basenames
        • Basename!
        • Ls-subdirs!
        • Ls-files!
        • Dirname!
        • Ls!
        • Catpaths
        • Mkdir!
        • Rmtree!
        • Remove-nonstrings
      • Bridge
      • Clex
      • Tshell
      • Unsound-eval
      • Hacker
      • ACL2s-interface
      • Startup-banner
      • Command-line
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • 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.