#!/usr/bin/guile !# (import (sph) (sph alist) (sph cli) (sph rate)) (define program-description "this program sorts files by moving them into and between numerically named directories. first it searches upwards to see if a numeric directory name exists in path, if yes, then only the file hierarchy under that number is moved into a directory with the given number. if no numeric directory exists in path, a numeric directory is created in the current working directory and given paths are moved under there. examples: cwd: / rate 2 /a/0/b/c -> /a/2/b/c cwd: / rate 2 /a/b/c -> /2/a/b/c cwd: /a/b rate 2 /a/b/c -> /a/b/2/c") (define cli (cli-create #:description program-description #:options (q (((number path ...) #:required? #t))))) (define (rate-cli) (alist-bind (cli) (number path) (let (number (string->number number)) (map (l (path) (rate number path)) path)))) (rate-cli)