
isk defragmenters, antiviruses, backup utilities, and file compression tools are a few examples of applications that operate on directories. Alas, standard C++ doesn't have a library for manipulating directories. Consequently, programmers resort to third-party libraries and platform-dependent hacks for mundane operations such as listing files in a directory, creating new directories, and deleting directory files. These workarounds compromise code portability and force developers to learn different libraries every time. Thankfully, you can use the quasi-standard
<dirent.h> and
<dir.h> libraries to manipulate directories in a portable and platform-neutral fashion.

How can you operate on directories using a portable and standardized library?

Use the <dirent.h> and <dir.h> libraries to list directory files and perform other directory-related operations.