Date: Wed, 9 Apr 2003 07:02:14 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: David Banning <david@skytracker.ca> Cc: questions@freebsd.org Subject: Re: how to find file older than... Message-ID: <20030409040214.GE650@gothmog.gr> In-Reply-To: <20030408151104.A32743@skytrackercanada.com> References: <20030408151104.A32743@skytrackercanada.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2003-04-08 15:11, David Banning <david@skytracker.ca> wrote:
>
> I want to delete files that are older than 1/2 hr in a particular
> directory. the only way I can think of doing it is by doing a "test"
> and comparing the date to another file. I would then have to create
> -that- comparison file 1/2 hour before.
>
> Is there an easier way?
I usually rely on find to do this sort of thing:
$ ls -l
total 19281
-rw-rw-r-- 1 giorgos giorgos 381 Apr 9 06:31 _get.sh
-rw-r--r-- 1 giorgos giorgos 13406367 Apr 8 21:27 outlook.zip
-rw-rw-r-- 1 giorgos giorgos 6309248 Apr 9 06:57 mozilla-win32-1.3-elGR-installer.exe
$ find . -type f -mtime -2h
./_get.sh
./mozilla-win32-1.3-elGR-installer.exe
The -mtime switch accepts various units that I'm sure you'll find useful
for specifying time intervals, and you can even combine them as in
find -mtime 3d15h
- Giorgos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030409040214.GE650>
