help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quickly find all executables


From: Kevin Rodgers
Subject: Re: quickly find all executables
Date: Thu, 24 Jul 2003 14:27:34 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Kin Cho wrote:

Kevin Rodgers <address@hidden> writes:


(let ((directories exec-path)
     (executables '()))
 (while directories
   (let ((files (if (file-directory-p (car directories))
                     (directory-files (car directories) t nil t)
                   '())))
     (while files
        (if (and (file-regular-p (car files))
                 (file-executable-p (car files)))
            (setq executables (cons (car files) executables)))
        (setq files (cdr files))))
   (setq directories (cdr directories)))
 (nreverse executables))


Thanks.  I used add-to-list above to avoid adding duplicates that
won't be used anyway.

But the files are full path names, so there won't be any exact duplicates.


--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]