Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2001 10:35:39 +1000
From:      "MurrayTaylor" <MurrayTaylor@bytecraftsystems.com>
To:        "Mike Meyer" <mwm@mired.org>, "MurrayTaylor" <taylorm@bytecraft.au.com>
Cc:        <questions@freebsd.org>
Subject:   Re: Checking for files older than a certain time
Message-ID:  <004301c13022$87ad7e00$2a7627cb@bytecraft.au.com>
References:  <15243.29297.979053.59546@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help

----- Original Message -----
From: "Mike Meyer" <mwm@mired.org>
To: "MurrayTaylor" <taylorm@bytecraft.au.com>
Cc: <questions@freebsd.org>
Sent: Tuesday, August 28, 2001 8:29 PM
Subject: Re: Checking for files older than a certain time


> 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?
>

I am actually using this as a 'mini-grace' period so that a user
can put a file into the temp area on a friday and just get to it
on the second monday following before it gets the bullet.

I guess what I am really looking for is the time that the file was
'created' in this directory (moved or copied or new file directly created)
which is what I was alluding to with the diff type approach.

I could do it by running a diff on the directory every day and saving
the output to a dated file that is then used to feed into a
"14dayslater" script to wipe em out ...

> 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?004301c13022$87ad7e00$2a7627cb>