# PetscTestDirectory
checks for the existence of a directory 
## Synopsis
```
PetscErrorCode PetscTestDirectory(const char dirname[], char mode, PetscBool *flg)
```
Not Collective


## Input Parameters

- ***dirname -*** the directory name
- ***mode -*** either 'r', 'w', or 'x'



## Output Parameter

- ***flg -*** the directory exists and satisfies the mode





## See Also
 `PetscTestFile()`, `PetscLs()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/fileio/ftest.c.html#PetscTestDirectory">src/sys/fileio/ftest.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/fileio/ftest.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
