I have a plan to use find to provide me with a list of files older than FILE, and then use xargs (or -exec ) to move the files to another location. Moving things is not a problem; | xargs mv {} ~/trash | xargs mv {} ~/trash working fine.
Now if I try to use ! -newer FILE ! -newer FILE , then FILE included in the list that I do not need!
The functionality of this command argument really makes sense logically, though, because βno newerβ could well be interpreted as βthe same or older,β as here:
$ find . ! -newer Selection_008.png -exec ls -l {} \;
contains the file from the comparison argument:
-rw-r--r-- 1 and and 178058 2012-09-24 11:46 ./Selection_004.png -rw-r--r-- 1 and and 16260 2012-09-21 11:25 ./Selection_003.png -rw-r--r-- 1 and and 38329 2012-10-04 17:13 ./Selection_008.png -rw-r--r-- 1 and and 177615 2012-09-24 11:53 ./Selection_005.png
( ls -l only shows dates for illustrative purposes)
What I really need from find is the -older parameter, but none of them are specified in find(1) ...
Of course, you can just pass the output through grep -v , use sed , etc. or use an environment variable to reuse the file name (fx. for grep -v ) so that I can enjoy the DRY principle, for example
$ COMP=Selection_008.png find . ! -newer $COMP | grep -v $COMP | xargs ...
but it seems like this is a lot of writing for oneliner, and that is not what I am looking for.
Is there a shorter / easier way than find or am I missing an option? I checked the man page and searched for Google and SO ...