prune-directory-list

prune-directory-list is a compiled Lisp function in `files.el'.

(prune-directory-list DIRS &optional KEEP REJECT)

Return a copy of DIRS with all non-existent directories removed.
The optional argument KEEP is a list of directories to retain even if
they don't exist, and REJECT is a list of directories to remove from
DIRS, even if they exist; REJECT takes precedence over KEEP.

Note that membership in REJECT and KEEP is checked using simple string
comparison.