On Mon, Mar 11, 2002 at 09:50:08PM -0500, Grigsby, Garl wrote:
> I
> need to go through a directory and move any file older than 10 days. How
> do I go about this?

===
#!/bin/sh
#
# call with a directory name
#
  
TS=`mktemp ~/tmp/timestamp.XXXXXX`
SECS=`expr 10 \* 24 \* 60 \* 60`
echo $SECS
OLDTIME=`date -r $(expr $(date +%s) - $SECS) +%y%m%d%H%M.%S`
touch -t $OLDTIME $TS
find $1 -type f -a \! -newer $TS | xargs ls -l

exit 0
===

> I know that I could probably
> come up with a really (really) ugly set of logic statements, but there
> has got to be an easier way.

Well, it's not exactly elegant, but it should do the trick (does on
OpenBSD at least).

--
<[EMAIL PROTECTED]>

Reply via email to