Created
December 9, 2008 06:58
-
-
Save liquidz/33816 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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