This section describes how to distinguish various kinds of files, such as directories, symbolic links, and ordinary files.
file-symlink-p
function returns the file name to which it is linked. This may be the
name of a text file, a directory, or even another symbolic link, or it
may be a nonexistent file name.
If the file filename is not a symbolic link (or there is no such file),
file-symlink-p returns nil.
(file-symlink-p "foo")
=> nil
(file-symlink-p "sym-link")
=> "foo"
(file-symlink-p "sym-link2")
=> "sym-link"
(file-symlink-p "/bin")
=> "/pub/bin"
t if filename is the name of an
existing directory, nil otherwise.
(file-directory-p "~rms")
=> t
(file-directory-p "~rms/lewis/files.texi")
=> nil
(file-directory-p "~rms/lewis/no-such-file")
=> nil
(file-directory-p "$HOME")
=> nil
(file-directory-p
(substitute-in-file-name "$HOME"))
=> t
t if the file filename exists and is
a regular file (not a directory, symbolic link, named pipe, terminal, or
other I/O device).
Go to the first, previous, next, last section, table of contents.