Directory Functions

Contact Us or call 1-877-932-8228
Directory Functions

Directory Functions

The following table shows some of the more common directory functions.

Function Description
mkdir() Creates a directory.
rmdir() Deletes a directory.
opendir() Opens a directory for reading.
readdir() Reads the contents of an open directory.

Getting a Directory Listing

To get a directory listing, use the opendir() function to open the directory and the readdir() function to read its contents. Then loop through its contents with a while loop outputting the name of each file and folder.