scheme shell
about
download
support
resources
docu
links
 
scsh.net

Create Directory With Parents

This extends CREATE-DIRECTORY to create the intermediate directories, too.

Needs scsh 0.6.6 or later.

  (define (create-directory-w/parents fname . perms-override?)
    (let ((comps (split-file-name fname)))
      (let lp ((comps comps))
        (if (not (null? comps))
            (let ((parent (drop-right comps 1)))
              (lp parent)
              (if (file-not-exists? (path-list->file-name comps))
                (apply create-directory
                       (path-list->file-name comps) perms-override?)))))))

MartinGasbichler


CreateDirectoryWithParents - raw wiki source | code snippets archive