Check if a Directory Exists

DESCRIPTION:

Tests for the existence of directories or symbolic links with given names.

USAGE:

is.dir(dir) 
is.symlink(path)

REQUIRED ARGUMENTS:

dir
a character vector of path names.
path
a character vector of path names.

VALUE:

a logical vector having the same length as the input.

When calling is.dir the return vector contains TRUE for each input name that is a directory or FALSE if either the name exists but is not a directory or if the path name does not exist.

The return vector of function is.symlink contains TRUE for each input name that is a symbolic link to a file or directory. On Windows systems, the values returned by this function will always be FALSE.

DETAILS:

The function is.dir returns TRUE if the name is a symbolic link to a directory.

On Windows systems, the value(s) returned by is.symlink will be FALSE.

SEE ALSO:

, , .

EXAMPLES:

if(file.exists("xyz") && !is.dir("xyz")) 
        cat("xyz is a file but not a directory\n") 
if(is.dir("abc") && is.symlink("abc")) 
        cat("abc is a link to a directory\n")