#| #!/usr/bin/env sh exec chibi-scheme -A `dirname $0` $0 $@ |# (import (scheme base) (srfi 1) (chibi) (chibi filesystem) (chibi io) (chibi pathname) (chibi sxml)) (define outdir "www") (define bookdir "../books/out/") (define valid '("book-simple.pdf" "web.html" "web-simple.html" "cover.png")) (define (copy-books) "Copy books" (directory-fold-tree bookdir #f #f (lambda (file acc) (let ((output (make-path outdir "books" (path-relative-to file bookdir)))) (if (member (path-strip-directory file) valid) (begin (display "Loading: ") (display file) (display " to:") (display output) (newline) (create-directory* (path-directory output)) (call-with-output-file output (lambda (x) (send-file file x))))))) #\null)) (copy-books)