I have a directory full of files.
I want to initially pass each of those files through a command, and send the output to another file in a different directory as follows:
cat dir1/sourcefile | process.py > dir2/destfile
the name of "destfile" is unimportant, it can be any filename.
Easy enough, however - new files are being added to dir1 all the time, and existing files are occasionally being modified.
How can I write a bash script (or another type of script) that will keep an eye on dir1, and whenever a new file is added or modified, process it or re-process it into dir2?