Emacs: Zip Dir in Dired

By Xah Lee. Date: .
(defun xah-dired-to-zip ()
  "Zip the current file in `dired'.
If multiple files are marked, only zip the first one.
Require unix zip command line tool.
URL `http://xahlee.info/emacs/emacs/emacs_dired_zip_dir.html'
Version 2021-01-14"
  (interactive)
  (let ( (fName (elt (dired-get-marked-files) 0)))
    (shell-command
     (format
      "zip -r %s %s"
      (shell-quote-argument (concat (file-relative-name fName) ".zip"))
      (shell-quote-argument (file-relative-name fName))))))