Operate On Dir
;;; submitted by Friedrich Dominicus, added by the invisible hand
;;; do all sorts of things to files (file names) in a directory
(define (operate-on dir action transformer pattern)
(with-cwd dir
(for-each (lambda (file)
(action file (transformer file)))
(glob pattern))))
;; e.g.
(define (upcase-file-names dir pattern)
(operate-on dir rename-file string-upcase pattern))
OperateOnDir - raw wiki source |
code snippets archive
|