Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, so what I have right now is a c++ program that does work (replacing things) to files. The thing i need to do now is run this program on a folder. Pretty much run it on all .cpp and .h files in the folder. the program runs like :

program filename.cpp

so how do i recursively change that filename for each file in the folder/location of the program.

share|improve this question
up vote 2 down vote accepted

With find(1).

find some/dir \( -name '*.cpp' -o -name '*.h' \) -exec program {} \;
share|improve this answer
Worked perfectly. Thank you very much for a quick response too. – LiverpoolFTW Sep 28 '12 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .