I want to append the content of a file in my current directory to all the files in another directory recursively (so I need to append the content of that file to the files in the subdirectories too). So I tried to use find this way:

find dir -type f -exec cat toAppend >> {} \;

But it does not work as it seems to do nothing. What I'm doing wrong?

PS: I've solved the problem by doing

for i in `find dir -type f`
    cat toAppend >> $i

But I still cannot understand why my find invocation is wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.