Quote:
Originally Posted by cmanL
I want to write a Bash shell script to process all the files of a certain type in a directory. Something like this pseudo code:
...
Can this be done in C/C++? I've never written Bash scripts so please keep it simple. 
|
To do this in C check out the opendir and scandir functions. The info pages even include some nice examples. (Oh, and don't forget closedir() or you might run out of file handles.)
If you happen to be using the Qt libraries, they have a C++ class called QDir that you might use.
However, the bash script, shown previously, is the simplest approach. You can even do the processing part in a C/C++ program that would then only have to worry about the one file.