[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How do I test for the existens of a file
- From: "Jeff Pohlmeyer" <yetanothergeek@...>
- Date: Fri, 24 Oct 2008 14:01:42 -0500
Depending on your situation, simply knowing whether or not
the "name" exists in the file system might not tell you the
whole story.
On Linux the io.open(name, "r") will fail even on an existing
file if you don't have read permissions, and will succeed if
you do, even when the "name" is actually a directory. (Which
might not be what you expect.)
If you really want to know if it's a regular file and not some
other type of filesystem object, you might want to test for
something like: ( lfs.attributes(name, "mode") == "file" )
- Jeff