Search code examples
common-lisp

Common Lisp - how to say if a pathname points to a regular file or a directory?


Is it possible to 'stat' a file and find its file type - regular or directory?


Solution

  • I think there are several ways. probe-file followed by checking the returned true name to determine that it has a directory name but not a filename and type should do it. e.g. for a directory

    (pathname-name (probe-file filespec))
    
    -> NIL