Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.