Variable: find-ls-option
find-ls-option is a customizable variable defined in find-dired.el.gz.
Value
("-ls" . "-dilsb")
Documentation
A pair of options to produce and parse an ls -l-type list from find.
This is a cons of two strings (FIND-OPTION . LS-SWITCHES).
FIND-OPTION is the option (or options) passed to find to produce
a file listing in the desired format. LS-SWITCHES is a set of
ls switches that tell Dired how to parse the output of find.
The two options must be set to compatible values.
For example, to use human-readable file sizes with GNU ls:
("-exec ls -ldh {} +" . "-ldh")
To use GNU find's inbuilt "-ls" option to list files:
("-ls" . "-dilsb")
since GNU find's output has the same format as using GNU ls with
the options "-dilsb".
While the option find -ls often produces unsorted output, the option
find -exec ls -ld maintains the sorting order only on short output,
whereas find -print | sort | xargs produces sorted output even
on a large number of files.
This variable was added, or its default value changed, in Emacs 27.1.
Probably introduced at or before Emacs version 27.1.
Source Code
;; Defined in /usr/src/emacs/lisp/find-dired.el.gz
;; find's -ls corresponds to these switches.
;; Note -b, at least GNU find quotes spaces etc. in filenames
(defcustom find-ls-option
(if (eq 0
(ignore-errors
(process-file find-program nil nil nil null-device "-ls")))
find-ls-option-default-ls
find-ls-option-default-exec)
"A pair of options to produce and parse an `ls -l'-type list from `find'.
This is a cons of two strings (FIND-OPTION . LS-SWITCHES).
FIND-OPTION is the option (or options) passed to `find' to produce
a file listing in the desired format. LS-SWITCHES is a set of
`ls' switches that tell Dired how to parse the output of `find'.
The two options must be set to compatible values.
For example, to use human-readable file sizes with GNU ls:
(\"-exec ls -ldh {} +\" . \"-ldh\")
To use GNU find's inbuilt \"-ls\" option to list files:
(\"-ls\" . \"-dilsb\")
since GNU find's output has the same format as using GNU ls with
the options \"-dilsb\".
While the option `find -ls' often produces unsorted output, the option
`find -exec ls -ld' maintains the sorting order only on short output,
whereas `find -print | sort | xargs' produces sorted output even
on a large number of files."
:version "27.1" ; add choice of predefined set of options
:type `(choice
(cons :tag "find -ls"
(string ,(car find-ls-option-default-ls))
(string ,(cdr find-ls-option-default-ls)))
(cons :tag "find -exec ls -ld"
(string ,(car find-ls-option-default-exec))
(string ,(cdr find-ls-option-default-exec)))
(cons :tag "find -print | sort | xargs"
(string ,(car find-ls-option-default-xargs))
(string ,(cdr find-ls-option-default-xargs)))
(cons :tag "Other values"
(string :tag "Find Option")
(string :tag "Ls Switches")))
:group 'find-dired)