quickutil icon indicating copy to clipboard operation
quickutil copied to clipboard

WALK-DIRECTORY-TREE

Open j3pic opened this issue 4 years ago • 0 comments

;; Write the code here.

(defun walk-directory-tree (file-handler pathname)
    "Walks down a directory tree and calls the FILE-HANDLER on every                                                                                                               
non-directory file.                                                                                                                                                                
                                                                                                                                                                                   
You can invoke the restart SKIP-FILE to skip processing of the current file, or                                                                                                    
RETRY to call your FILE-HANDLER again with the same file."
    (map-directory (lambda (file)
                     (if (uiop/filesystem:directory-exists-p file)
                         (walk-directory-tree file-handler file)
                         (with-retry retry "Try processing this file again"
                           (restart-case (funcall file-handler file)
                             (skip-file () :report "Skip this file"
                                        nil)))))
                   pathname))

Provides: WALK-DIRECTORY-TREE Requires: UIOP, WITH-RETRY https://github.com/stylewarning/quickutil/issues/65 Author: j3pic License: BSD

j3pic avatar Feb 16 '21 20:02 j3pic