The version of find doesn’t support the -newermt predicate

If your version of find doesn’t support the -newermt predicate,you can use the -newer predicate. That predicate needs a file as a reference: instead of an absolute modification date, it will use the modification date of the file. You can create appropriate “marker files” for this purpose, for example:

touch /tmp/mark.start -d “2016-11-22 10:00”
touch /tmp/mark.end -d “2016-11-23 23:00”
And then rewrite using -newer predicate:

find /some/path -newer /tmp/mark.start ! -newer /tmp/mark.end
Finally, your tar won’t work if the argument list is too long and xargs splits to multiple executions, because all executions will recreate the tar file. You need to use the -T flag of tar instead of xargs:

find /some/path -print0 | tar acf out.tar.gz –null -T-

More example:

Find files newer than “start” and older than “end”

touch /tmp/mark.start -d “2016-02-16 00:00”

touch a -d “2016-02-15 00:01”

touch b -d “2016-02-16 00:01”

touch c -d “2016-02-17 00:00”

touch d -d “2016-02-18 00:00”

touch e -d “2016-02-19 00:01”

touch /tmp/mark.end -d “2016-02-19 00:00”
Command: find . -type f -newer /tmp/mark.start ! -newer /tmp/mark.end



-bash-3.2$ find . -type f -newer /tmp/mark.start ! -newer /tmp/mark.end