GNU find - execute command after find results

Normally we use the "find" command to search for some files and post process it using the pipe ("|"). But do you know find can process the results without using pipe? Here it is :

Some notes on the "-exec" parameter :

- the result are represent by '{}' (literally with the quotes)

- after telling "find" what to process, end the command with "\;" so that it understand that is the end of the command.
find . -iname '<glob pattern>' -exec <commands & parameters to exec> \;

find . -iname '*.txt' -exec mv '{}' /my/documents/folder \;
find . -iname '*.tmp' -exec rm -rf '{}' \;

AdiĆ³s !!!

No comments: