From owner-freebsd-questions@FreeBSD.ORG Mon Jan 2 18:13:17 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 155B216A41F for ; Mon, 2 Jan 2006 18:13:17 +0000 (GMT) (envelope-from drew@mykitchentable.net) Received: from relay01.roc.ny.frontiernet.net (relay01.roc.ny.frontiernet.net [66.133.182.164]) by mx1.FreeBSD.org (Postfix) with ESMTP id B007A43D64 for ; Mon, 2 Jan 2006 18:13:03 +0000 (GMT) (envelope-from drew@mykitchentable.net) Received: from filter03.roc.ny.frontiernet.net (filter03.roc.ny.frontiernet.net [66.133.183.70]) by relay01.roc.ny.frontiernet.net (Postfix) with ESMTP id D41353640D7; Mon, 2 Jan 2006 18:13:02 +0000 (UTC) Received: from relay01.roc.ny.frontiernet.net ([66.133.182.164]) by filter03.roc.ny.frontiernet.net (filter03.roc.ny.frontiernet.net [66.133.183.70]) (amavisd-new, port 10024) with LMTP id 25018-12-10; Mon, 2 Jan 2006 18:13:02 +0000 (UTC) Received: from blacklamb.mykitchentable.net (67-51-143-222.dsl1.elk.ca.frontiernet.net [67.51.143.222]) by relay01.roc.ny.frontiernet.net (Postfix) with ESMTP id D70A436408C; Mon, 2 Jan 2006 18:13:01 +0000 (UTC) Received: from [192.168.1.3] (unknown [192.168.1.3]) by blacklamb.mykitchentable.net (Postfix) with ESMTP id CE2AAAE946; Mon, 2 Jan 2006 10:13:00 -0800 (PST) Message-ID: <43B96D2A.5080104@mykitchentable.net> Date: Mon, 02 Jan 2006 10:12:58 -0800 From: Drew Tomlinson User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Brunelle References: <20060102171456.25239.qmail@web86911.mail.ukl.yahoo.com> <43B961C4.8020505@mykitchentable.net> <200601021259.09740.kruptos@mlinux.org> In-Reply-To: <200601021259.09740.kruptos@mlinux.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-2.3.2 (20050629) at filter03.roc.ny.frontiernet.net Cc: freebsd-questions@freebsd.org Subject: Re: Find Syntax X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2006 18:13:17 -0000 On 1/2/2006 9:59 AM Kevin Brunelle said the following: >>OK, I understand now. I ultimately want to delete files and was just >>trying to check my command before doing the actual delete. I will use >>'-ls' in my script. >> >> >> >>>find . -type f -mtime +1w -exec ls -l {} \; >>> >>> >>This works too. Thanks again! >> >> > >What is your intent with the -ls? Do you need the full listing because I find >that if I just want to know what files are removed the "-print" switch is >cleaner. Or, once I am comfortable that the command is doing what I want, >leaving off the output entirely. > > I'm running ntop with the rrd plugin and found that it quickly filled my drive. My intent is to delete rrd files that are older than so many days to save disk space. I just wanted to verify that my '-mtime' was returning the results I expected before actually deleting. 'ls -l' keeps the date in the same place on the screen so I can scan with my eyes as the results scroll by. Once I verify I'm getting the results I want, '-ls -l' is no longer needed. >For my temp file deletions I use > >/usr/bin/find /home/kevinb/tmp -atime +3 -exec rm {} \; > > '-delete' can be used in place of '-exec rm {} \;". I suspect '-delete' is more efficient but it's just a guess. >Yes, I keep my own tmp/ directory below my home directory (it's an old habit). >This command deletes anything I haven't accessed in three or more days. I >use access (-atime) here but modification works just as well. I have that in >a script which cron runs once a day so I can use my temporary folder and not >worry about cleaning up after myself... and I know that anything I put there >I expect to lose unless I find a reason to keep it and move it somewhere >else. > >As a word of warning, don't run this in your home directory or in a location >where there are files which will sit around without being used for months at >a time. You would really be upset if ~/.cshrc happened to vanish or any >other file you rely on but don't think of. > > I've got things working now. Thanks for your help! Drew