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

How do I tell if a file is a plain file or a directory?



If "/tmp/subdir" is a directory and "/tmp/foo.lisp" is a plain file:

  .> (probe-file "/tmp/subdir")
  #p"/tmp/subdir"
  .> (probe-file "/tmp/subdir/")
  #p"/tmp/subdir/"
  .> (probe-file "/tmp/foo.lisp")
  #p"/tmp/foo.lisp"
  .> (probe-file "/tmp/foo.lisp/")
  #p"/tmp/foo.lisp/"                <- NIL seems more sensible


How do I tell from lisp if a given file is a plain file or directory,
aside from doing (excl:run-shell-command "/bin/test -d filename")?


-----------------
Eric McCarthy
Reasoning Systems
eric@reasoning.com