Skip to content

Instantly share code, notes, and snippets.

@liquidz
Created December 9, 2008 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liquidz/33816 to your computer and use it in GitHub Desktop.
Save liquidz/33816 to your computer and use it in GitHub Desktop.
(use file.util)
(define (keta-awase num keta)
(let* ((tmp (number->string num))
(len (string-length tmp))
)
(if (< len keta)
(string-append (make-string (- keta len) #\0) tmp)
tmp
)
)
)
(define (time->string t)
(string-append
(keta-awase (+ 1900 (ref t 'year)) 4)
(keta-awase (+ 1 (ref t 'mon)) 2)
(keta-awase (ref t 'mday) 2)
)
)
(define (do-file-huriwake path)
(for-each
(lambda (file)
(let* ((filename (string-append path file))
(type (file-type filename))
(ts (time->string (sys-gmtime (file-mtime filename))))
)
(unless (eq? type 'directory)
(make-directory* (string-append path ts))
(move-file filename (string-append path ts "/" file))
)
)
)
(directory-list path :children? #t)
)
)
(define (main args)
(when (= 2 (length args))
(do-file-huriwake (cadr args))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment