del txt

The Redefine Team Lv5
#lang racket
(define path (path->directory-path "/tmp"))
(define pathStr (path->string path))
(define file-list (filter 
                    (lambda (f)
                    (regexp-match #rx"[^-ms]\\.txt" f)) (directory-list path)))
(define (del-file file-list)
(cond [(empty? file-list) '()]
        [else 
        (define f (string->path (string-append pathStr (path->string (car file-list)))))
        (if (file-exists? f)
            (delete-file f)
            (displayln f)
            )
        (del-file (cdr file-list))
        ]))
(del-file file-list)
  • 标题: del txt
  • 作者: The Redefine Team
  • 创建于 : 2013-10-01 10:35:00
  • 更新于 : 2023-05-23 18:52:03
  • 链接: https://redefine.ohevan.com/2013/10/01/del-txt/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
del txt