What is the difference between:find . -name "*.txt" and find . -name "*.txt" -print ?
I mean what is the use of print in find. I see that it prints the results anyway so why is this option available?
1 Answer
In very old versions of find, -print wasn't implicit so was required.
Nowadays, it is the default action but is still useful when combined with -prune to avoid the default action to encompass the pruning. eg:
This won't print files named foo under /tmp:
find /tmp -name foo -prune -o -type f -printThis will:
find /tmp -name foo -prune -o -type f 1