Function std.file.isFile
Returns whether the given file (or directory) is a file.
On Windows, if a file is not a directory, then it's a file. So,
either
or isFile
will return true for any given file.
isDir
On Posix systems, if
is isFile
true
, that indicates that the file
is a regular file (e.g. not a block not device). So, on Posix systems, it's
possible for both
and isFile
to be isDir
false
for a
particular file (in which case, it's a special file). You can use
to get the attributes to figure out what type of special
it is, or you can use getAttributes
to get at its DirEntry
statBuf
, which is the
result from stat
. In either case, see the man page for stat
for
more information.
Prototype
bool isFile( const(char[]) name ) @property @safe;
Parameters
Name | Description |
---|---|
name | The path to the file. |
Throws
if the given file does not exist.
FileException
Examples
assert("/etc/fonts/fonts.conf".isFile); assert(!"/usr/share/include".isFile);
Authors
Walter Bright, Andrei Alexandrescu, Jonathan M Davis