how to find file older than...
Giorgos Keramidas
keramida at ceid.upatras.gr
Tue Apr 8 21:03:45 PDT 2003
On 2003-04-08 15:11, David Banning <david at 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
More information about the freebsd-questions
mailing list