2002-05-01 Yuuichi Teranishi <teranisi@gohome.org>
+ * elmo-util.el (elmo-delete-match-files): New function.
+
+ * elmo-localdir.el (elmo-folder-delete): Use elmo-delete-match-files
+ instead of elmo-delete-directory.
+
* elmo-shimbun.el (elmo-shimbun-get-headers): Bind
elmo-hash-minimun-size as 63.
(let ((dir (elmo-localdir-folder-directory-internal folder)))
(if (not (file-directory-p dir))
(error "No such directory: %s" dir)
- (elmo-delete-directory dir t)
+ (elmo-delete-match-files dir "[0-9]+" t)
t)))
(luna-define-method elmo-folder-rename-internal ((folder elmo-localdir-folder)
(unless hierarchy
(delete-directory path)))))
+(defun elmo-delete-match-files (path regexp &optional remove-if-empty)
+ "Delete directory files specified by PATH.
+If optional REMOVE-IF-EMPTY is non-nil, delete directory itself if
+the directory becomes empty after deletion."
+ (when (stringp path) ; nil is not permitted.
+ (dolist (file (directory-files path t regexp))
+ (delete-file file))
+ (if remove-if-empty
+ (ignore-errors
+ (delete-directory path) ; should be removed if empty.
+ ))))
+
(defun elmo-list-filter (l1 l2)
"L1 is filter."
(if (eq l1 t)