Originally Posted by clcbluemont
find /usr \( -newer /tmp/empty_file -a \! -newer /tmp/empty_file1 \) -print
But this shows me files that should not be output
The search criteria should be fine. What stuff do you see as unwanted output?
In any case you may want to limit the results to files and exclude directories, otherwise the tar command will archive the entire content of the directories (despite the timestamp of the files inside).
Moreover, take in mind that -exec executes the command multiple times, each one over each line of input (that is over each object found). Typically the tar command is used over a bunch of files all together, hence better to pipe the output to xargs, like in
find /usr -type f \( -newer /tmp/empty_file -a \! -newer /tmp/empty_file1 \) -print0 | xargs -0 tar cvvpf some.tar
In cases where -type f does not appear in the search refinement, you might add --no-recursion to the tar options to avoid directories archived twice.