Categories
System Software Notes Unix Notes

find and dates

Let’s assume that -newer is just what we ordered. How do I get a file to use for comparison? Well, I could read the man page for “touch” and discover that these commands


touch -t 200503020500 foo.end
touch -t 200503020400 foo.start

give me files that I can use in this command

find / -newer ./foo.start -and -not -newer ./foo.end -print

which is probably the niftiest way to specify logical conditions on a command line that I have seen (never mind that my shell and your shell may get in the way of the commands we want to type)

If I had decided to read the fine CVS man page I would have found this command to be less opaque

find / -newermt "2005-03-04 04:00" -and -not -newermt "2005-03-04 05:00" -print

How do I make -print not line-wrap on the -?