From owner-freebsd-questions Thu Jul 12 11:29: 6 2001 Delivered-To: freebsd-questions@freebsd.org Received: from oddjob.adhesivemedia.com (oddjob.adhesivemedia.com [207.202.159.77]) by hub.freebsd.org (Postfix) with ESMTP id F1F0937B403 for ; Thu, 12 Jul 2001 11:29:03 -0700 (PDT) (envelope-from philip@adhesivemedia.com) Received: from localhost (philip@localhost) by oddjob.adhesivemedia.com (8.11.1/8.11.1) with ESMTP id f6CISuO77771; Thu, 12 Jul 2001 11:28:56 -0700 (PDT) (envelope-from philip@adhesivemedia.com) Date: Thu, 12 Jul 2001 11:28:56 -0700 (PDT) From: Philip Hallstrom To: David Hill Cc: , , Subject: Re: File Management... In-Reply-To: <20010712140222.6b5f1ca7.david@phobia.ms> Message-ID: <20010712112710.U77691-100000@oddjob.adhesivemedia.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 > > > Hello Everyone, > > > > > > Would anyone know how to delete files based on the date modified > > > timestamp of files? > > > > find /your/path/to/clean/up -date 3 -rm > > > > man find is your friend. > > > both -date and -rm are not options > > Try this example > > find /path -name *.txt -mtime argument | xargs rm -f You might want to do it like this: find /path -name *.txt -mtime argument -print0 | xargs -0 /bin/rm The -print0 -0 stuff will use \0 as a deliminator rather than a space so that if you have a file named "some text file.txt" it will get passed to xargs correctly... And using /bin/rm will ensure that you really are using the rm you want to. And of course it's always a really good idea to just print out the results of the find before removing them :) -philip To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message