20.1. Directory is not a file

20.1.1. Function EXT:PROBE-PATHNAME

CLISP has traditionally taken the view that a directory is a separate object and not a special kind of file, so whenever the standard says that a function operates on files without specifically mentioning that it also works on directories, CLISP SIGNALs an ERROR when passed a directory.

CLISP provides separate directory functions, such as EXT:DELETE-DIRECTORY, EXT:RENAME-DIRECTORY et al.

You can use DIRECTORY or EXT:PROBE-PATHNAME to figure out whether a given namestring refers to a file or a directory.

20.1.1. Function EXT:PROBE-PATHNAME

Function EXT:PROBE-PATHNAME figures out whether the argument refers to an existing directory or an existing regular file, and returns 4 values if the filesystem object exists:

or NIL if it does not exist. E.g., if you have a file file, a directory directory, a symbolic link link-file pointing to file and a symbolic link link-dir pointing to directory, then

(EXT:PROBE-PATHNAME #P"filename")
⇒ #P"/.../filename"
⇒ #P"/.../filename"
⇒ 3427467015
⇒ 3171976
(EXT:PROBE-PATHNAME #P"filename/")
⇒ #P"/.../filename"
⇒ #P"/.../filename"
⇒ 3427467015
⇒ 3171976
(EXT:PROBE-PATHNAME #P"directory")
⇒ #P"/.../directory/"
⇒ #P"/.../directory/"
⇒ 3426940352
⇒ 1024
(EXT:PROBE-PATHNAME #P"directory/")
⇒ #P"/.../directory/"
⇒ #P"/.../directory/"
⇒ 3426940352
⇒ 1024
(EXT:PROBE-PATHNAME #P"link-file")
⇒ #P"/.../filename"
⇒ #P"/.../link-file"
⇒ 3427467015
⇒ 3171976
(EXT:PROBE-PATHNAME #P"link-file/")
⇒ #P"/.../filename"
⇒ #P"/.../link-file"
⇒ 3427467015
⇒ 3171976
(EXT:PROBE-PATHNAME #P"link-dir")
⇒ #P"/.../directory/"
⇒ #P"/.../link-dir/"
⇒ 3426940352
⇒ 1024
(EXT:PROBE-PATHNAME #P"link-dir/")
⇒ #P"/.../directory/"
⇒ #P"/.../link-dir/"
⇒ 3426940352
⇒ 1024

These notes document CLISP version 2.49Last modified: 2010-07-07