[Samba] file "time-to-live"
mikeegg1 at mac.com
Tue Jun 29 09:16:06 MDT 2010
On Tue, 29 Jun 2010, Brian Cuttler might have said:
> You could write something to check file create times and
> delete files older than 36 hours, and run if from cron
> several times per day.
> I'd suggest # find, but it doesn't have the granularity
> you are looking for, you could run it at 00:01 and remove
> files there where 2 days old.
> I did somethign similar on a VMS system I was managing, worked
> well until some enterprising student found (I don't believe
> they wrote it themselves) a program to reset the time stamp
> on their files (which your users may start doing as well, perhaps
> using # touch). At which point I started looking for files with
> creation dates in the future... many users of the date reset
> program wheren't quite as smart as they thought they where.
(not tested and for GNU/linux)
# delete files older than yesterday
# create a temporary file
touch -d yesterday $tf
# find all older files
find $dir ! -newer $tf -print > $tf
# delete older files
xargs rm -rf < $tf
# clean up
rm -f $tf
More information about the samba