From owner-freebsd-questions Tue Aug 28 17:35:48 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wombat.bytecraft.au.com (wombat.bytecraft.au.com [203.39.118.3]) by hub.freebsd.org (Postfix) with ESMTP id B68C137B405 for ; Tue, 28 Aug 2001 17:35:42 -0700 (PDT) (envelope-from MurrayTaylor@bytecraftsystems.com) Received: from lt99101401.bytecraft.au.com (unknown [203.39.118.42]) by wombat.bytecraft.au.com (Postfix) with SMTP id 25F813F02; Wed, 29 Aug 2001 10:35:41 +1000 (EST) Message-ID: <004301c13022$87ad7e00$2a7627cb@bytecraft.au.com> Reply-To: "MurrayTaylor" From: "MurrayTaylor" To: "Mike Meyer" , "MurrayTaylor" Cc: References: <15243.29297.979053.59546@guru.mired.org> Subject: Re: Checking for files older than a certain time Date: Wed, 29 Aug 2001 10:35:39 +1000 Organization: Bytecraft Systems MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 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 ----- Original Message ----- From: "Mike Meyer" To: "MurrayTaylor" Cc: Sent: Tuesday, August 28, 2001 8:29 PM Subject: Re: Checking for files older than a certain time > 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? > 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 Meyer 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