2 changed files with 42 additions and 3 deletions
@ -0,0 +1,33 @@ |
|||
#lang racket |
|||
|
|||
(require racket/system) |
|||
|
|||
(define (clean-path path) |
|||
(string-replace path "/" "_")) |
|||
|
|||
(define (compress directory) |
|||
(define tar |
|||
(find-executable-path "tar")) |
|||
|
|||
(define path |
|||
(format "/tmp/~a.tar.gz" |
|||
(clean-path directory))) |
|||
|
|||
(system* tar "-zcvf" path directory) |
|||
path) |
|||
|
|||
(define (remove-tmp path) |
|||
(define rm |
|||
(find-executable-path "rm")) |
|||
(system* rm path)) |
|||
|
|||
(define (drop-last-dir path) |
|||
(define ps (explode-path path)) |
|||
(define paths (take ps (sub1 (length ps)))) |
|||
(path->string |
|||
(apply build-path paths))) |
|||
|
|||
(provide |
|||
drop-last-dir |
|||
compress |
|||
remove-tmp) |
Loading…
Reference in new issue