How to execute multiple commands with find and -exec...
I see several references to the ability to execute multiple commands on the results of a single find command.
What I am trying to do is use a flag to track which files have been processed by a recurring script. I find the files that do NOT have the flag set, then I process them. Next I want to set the flag. Problem is that the list of files returned by the flag will be different because time elapses between the first and second incidence of the find commands. So, what I want to do is use a single list to execute both commands. Anyone have a single line solution that does NOT involve writing a script, or a solution that involves storing the results of the find in a temporary file? Thanks Tom EG: find ./ -flags noopaque -exec chmod a+x fins ./ -flags noopaque -exec chflags opaque repeat every 10 minutes Note - this is an example only - these are not the exact commands I am running... |
find ./ -flags noopaque -exec cmd1 -exec cmd2
painfully simple huh? |
Why not put it in a crontab?
10 * * * * * find ./ -flags noopaque |xargs chmod a+x && chflags opaque 2>&1 >/dev/null |
Ouch
Quote:
OUCH! Thanks! |
Quote:
find . -name "Batch*.txt" -exec cat {} -exec echo "============" \; ... cat: cannot open -exec cat: cannot open echo cat: cannot open ============ I really would appreciate any help! :) |
Each -exec action must terminate with an escaped semi-colon, otherwise all the rest of the line is interpreted as the command to execute.
Code:
find . -name "Batch*.txt" -exec cat {} \; -exec echo "============" \; |
Quote:
|
All times are GMT -5. The time now is 04:35 AM. |