From owner-freebsd-questions Tue Aug 28 3:29:15 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-94-248-46.mmcable.com [24.94.248.46]) by hub.freebsd.org (Postfix) with SMTP id E63BB37B40B for ; Tue, 28 Aug 2001 03:29:06 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 72601 invoked by uid 100); 28 Aug 2001 10:29:06 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15243.29297.979053.59546@guru.mired.org> Date: Tue, 28 Aug 2001 05:29:05 -0500 To: "MurrayTaylor" Cc: questions@freebsd.org Subject: Re: Checking for files older than a certain time In-Reply-To: <61866872@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG MurrayTaylor 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. 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