I have a command to encrypt (codecrypt) files like this example:

ccr -aer john -R file.txt > file.txt.ccr

I'd like to do a loop with several files, so I came up with this:

for a in *.txt; do ccr -aer john -R "$a" > "$a".ccr; done

I'd like to know how can I do the same approach using find, and if there is any performance advantage between find and for.


I would think that the for loop would be faster as find will not only look for files in the current directory but recurse any sub-directories. And for is a built-in shell command, where find is a separate program.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.