Mailinglist Archive: opensuse (2217 mails)

< Previous Next >
Re: [opensuse] how to know when the last time files have been accessed.
  • From: joe <joe@xxxxxxxxxx>
  • Date: Sun, 23 Sep 2007 19:30:08 -0700
  • Message-id: <46F72130.3090000@xxxxxxxxxx>


Arie Reynaldi Z wrote:
> Hi All,
> 
> I have samba file server that uses as file-sharing (mostly mp3). Right
> now I want to know which file (mp3) that have been accessed (read),
> not changed.. So I can delete all music files that stay too long but
> not played for a long time.. How can I do it ?
> I try 'ls -lat' .. buat I guess it said which file that have been
> changed / writed /edited. right ?

First make certain that atime is enabled on the filesystem of interest. Then
it's easy to test for last access time with a shell script, and delete those
files which haven't been accessed for whatever time period you decide.

Off the top of my head, you could have a cron job do something like:

find /path/to/mp3s -atime +90 -exec rm {} \;

every day at 0420 or something appropriate.

Joe
-- 
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References