Emacs: Zip Dir in Dired 🚀

By Xah Lee. Date: . Last updated: .
(defun xah-dired-to-zip ()
  "Zip the current file in `dired'.
If multiple files are marked, only zip the first one.

URL `http://xahlee.info/emacs/emacs/emacs_dired_zip_dir.html'
Created: 2021-01-14
Version: 2021-02-08"
  (interactive)
  (let ((xfname (elt (dired-get-marked-files) 0)))
    (async-shell-command
     (format
      "zip -r %s %s"
      (shell-quote-argument (concat (file-relative-name xfname) ".zip"))
      (shell-quote-argument (file-relative-name xfname))))))