Thanks. What I need is a command that allows me to select files from one or more directories for which I don't know the exact modification/access time, though. For example, a command to clean up a directory of all .log files that have modification time older than 5 days ago.
What I have now is this script
# This script can be used to filter files which have a last modification date
# ('ls -ltr --time-style=long-iso' format) between a lower and an upper date.
# ls -ltr --time-style=long-iso | bw 2004-06-01 00:00:00 2004-06-30 23:59:59
# This will print all files modified in June 2004.
awk -v d1=$1 -v t1=$2 -v d2=$3 -v t2=$4 \
start=sprintf("%s %s", d1, t1);\
end=sprintf("%s %s", d2, t2);\
gsub("-|:", " ", start);\
gsub("-|:", " ", end)\
this=sprintf("%s %s:00", $6, $7);\
gsub("-|:", " ", this);\
if(mktime(this) >= mktime(start) && mktime(this) <= mktime(end))\
But cannot be deployed on the machines I intend to use it for.