View Full Version : Going through a directory in C
Sep 16, 2008, 02:09 PM
I want to perform the same set of operations on every file in a directory. How do I go through the files in a directory one at a time if I don't know the names or numbers of files in the directory? I know I can use system commands to make a list and then read the list one at a time but Microsoft C used to have routines that would take care of everything for you.
Sep 16, 2008, 02:35 PM
readdir is probably what you are looking for.
Here is an example:
You can also just 'man readdir' from the terminal.
Sep 16, 2008, 02:37 PM
Did you try using Google? The first result for "directories C" is:
Sep 16, 2008, 02:39 PM