Add functions for working with fdupes output

This commit is contained in:
contrapunctus 2020-04-04 12:11:15 +05:30
parent 7f55fd2017
commit de362feaed
1 changed files with 26 additions and 0 deletions

View File

@ -391,3 +391,29 @@ ffmpeg must be installed on your system, of course."
(if (directory-name-p (dired-file-name-at-point))
(dired-find-file)
(launch-files-dired nil (dired-get-marked-files))))
(defun contrapunctus-delete-file-at-point (&optional prefix)
(interactive "P")
(let ((file (buffer-substring (point-at-bol)
(point-at-eol))))
(if (file-exists-p file)
(progn
(delete-file file)
(if prefix
;; delete current line
(delete-region (point-at-bol)
(1+ (point-at-eol)))
;; delete current paragraph
(mark-paragraph)
(delete-active-region)
(forward-line 2))
(message "Deleted %s" file))
(error "File %s does not exist!" file))))
(defun contrapunctus-file-at-point-exists-p ()
(interactive)
(let ((file (buffer-substring (point-at-bol)
(point-at-eol))))
(if (file-exists-p file)
(message "%s" t)
(error "File %s does not exist!" file))))