1 (mapcar #'ql
:quickload
'(:cl-fad
:cl-ppcre
))
3 (defun copy-season (source target
)
4 (fad:walk-directory source
5 (lambda (x) (multiple-value-bind (target-name matched?
)
6 (ppcre:regex-replace
".*/([0-9]{2})[.]([0-9]{2})[.](?:[0-9]{2})- (.*)"
8 '("Season " 0 " Episode " 1 " - " 2))
10 (format t
"matched, copying: ~A / ~A~%" x target-name
)
11 (fad:copy-file x
(merge-pathnames target-name
(make-pathname :directory
`(:absolute
,target
)))))))))
13 "/srv/archive/video/tv/The X-Files/Season 01"