Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2001 05:29:05 -0500
From:      Mike Meyer <mwm@mired.org>
To:        "MurrayTaylor" <MurrayTaylor@bytecraftsystems.com>
Cc:        questions@freebsd.org
Subject:   Re: Checking for files older than a certain time
Message-ID:  <15243.29297.979053.59546@guru.mired.org>
In-Reply-To: <61866872@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
MurrayTaylor <MurrayTaylor@bytecraftsystems.com> types:
> Given that I am running a Samba filesystem and have a 
> directory visible to the windoze users that is a 
> 'common' area, what comand could I use to 
> enforce a 14 day storage period before a mandatory erasure
> occurs? The file time stamps sometimes are waaaaay in the past
> if someone copies a historic file there so another someone can access it.
> Yet this historic file should remain in the 14daytemp directory for the 
> 14 day grace period
> 
> I would like to run a cron job with something like
> 
> find /tempdir -ctime +14 -delete {}
> 
> but testing this with -print seems to miss some files I reckon
> should be clobbered....

Well, I think you've got the correct format, but maybe not the right
tests. For instance, "+14" will test false for files with ctime of 14
days, and that won't be deleted until the 15th day. Could that be part
of the problem?

You also might want to check ctime vs. mtime, which is what ls
normally shows you. It's pretty simple to have a file with an ctime
more recent than the mtime, so it might get past the find, but an
eyball examination of an "ls -l" would show it should be gone. Of
course, I'm not sure how samba handles those time stamps in any case.

> Should I do something like 
> ll > somefile
> ...
> (14days later )
> diff ll somefile   (syntax ?)
> delete anything that pops out from the 14day old ll capture

That could be used, but runs the risk of clobbering a popular
scratchfile name that happened to be in use both times.

One alternative to consider if you're rebooting the system on a
regular basis for some reason - backups, maintenance, whatever - is to
just flush the area across reboots.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15243.29297.979053.59546>