Running program for every file in directory

I have just started learning Linux (Ubuntu) and I am not sure if this is the right forum to ask this question.

I have a list of 500 text files, that end with .txt and I already have a C++ program that can read in one file from the command line

 
processStock aapl.txt



I would like to run the processStock program using each of the input files.

Would this be a linux script or do I need to do something in C++?
Lots of ways to do that.. A simple shell loop could do:

for file in `cat files.lst`; do ./processStock "$file"; done

But in that case you need a file with the list of files that you want to process
I think it will be better to just for file in *.txt; do (the rest is the same) http://mywiki.wooledge.org/BashPitfalls#for_i_in_.24.28ls_.2A.mp3.29

(also, don't abuse the poor kitties)
Topic archived. No new replies allowed.