Function: chart-file-count
chart-file-count is an interactive and byte-compiled function defined
in chart.el.gz.
Signature
(chart-file-count DIR)
Documentation
Draw a chart displaying the number of different file extensions in DIR.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/chart.el.gz
;;; Sample utility function
(defun chart-file-count (dir)
"Draw a chart displaying the number of different file extensions in DIR."
(interactive "DDirectory: ")
(message "Collecting statistics...")
(let ((flst (directory-files dir nil nil t))
(extlst (list "<dir>"))
(cntlst (list 0)))
(dolist (f flst)
(let* ((x (file-name-extension f))
(s (if (file-accessible-directory-p (expand-file-name f dir))
"<dir>" x))
(m (member s extlst)))
(unless (null s)
(if m
(incf (car (nthcdr (- (length extlst) (length m)) cntlst)))
(setq extlst (cons s extlst)
cntlst (cons 1 cntlst))))))
;; Let's create the chart!
(chart-bar-quickie 'vertical "Files Extension Distribution"
extlst "File Extensions"
cntlst "# of occurrences"
10
(lambda (a b) (> (cdr a) (cdr b))))
))