Seems straightforward enough to code up. I can take a stab at it.  Perhaps 
today. Call it File::Purge ? File::Find::Purge ?

Sent from my BlackBerry® smartphone with Nextel Direct Connect

-----Original Message-----
From: Jonathan Swartz <swa...@pobox.com>

Date: Wed, 1 Jul 2009 22:13:20 
To: <dhu...@hudes.org>
Cc: Bill Ward<b...@wards.net>; <william.w...@gmail.com>; 
<module-authors@perl.org>
Subject: Re: module/script to clean up old files and prune empty directories


My points about "find ... | xargs rm -f" apply as well to a simple  
File::Find. Namely, it doesn't have the safety checks, directory  
pruning, or reporting.

I am using File::Find::Object in the library.

On Jul 1, 2009, at 5:08 PM, Dana Hudes wrote:

> True to some extent. You do have to actually invoke it to build your  
> list and then unlink the files on the list. This seems fairly  
> trivial. Am I missing something?
> Sent from my BlackBerry® smartphone with Nextel Direct Connect
>
>
> From: Bill Ward
> Date: Wed, 1 Jul 2009 16:19:20 -0700
> To: <dhu...@hudes.org>
> Subject: Re: module/script to clean up old files and prune empty  
> directories
>
> File::Find can be used to write such a script, but doesn't by itself  
> address this issue.
>
> On Tue, Jun 30, 2009 at 6:15 PM, Dana Hudes <dhu...@hudes.org> wrote:
> File::Find::Perl
> ------Original Message------
> From: Jonathan Swartz
> To: module-authors@perl.org
> Sent: Jun 30, 2009 7:59 PM
> Subject: module/script to clean up old files and prune empty  
> directories
>
> At various places around our system we want to clean up files older
> than x, and sometimes prune empty directories. Naturally we have to be
> careful doing this lest we accidentally blow away far too many of the
> wrong files.
>
> I'm thinking about a Perl module and accompanying script with this
> interface:
>
>     cleanup_files.pl  --age=age --dir=dir --name=name [--dry-run] [--
> prune-empty-dirs]
>
> where age can be specified as "1h", "2day", etc., and name is a
> required glob pattern, and dir is checked to make sure it is
> sufficiently deep (e.g. can't use /). --dry-run tells you what would
> be deleted. --prune-empty-dirs also causes empty dirs to be pruned.
> The script would report at its end how many files and directories were
> removed.
>
> The idea is to have a convenient, but safe, one-liner to put in a cron
> for each directory that needs periodic cleaning.
>
> In the past we've done the old "find ... | xargs rm -f", but it
> doesn't have the safety checks, directory pruning, or reporting.
>
> Does anyone else think this is (mildly) valuable? Am I reinventing the
> wheel, in terms of Perl libraries or other Unix utilities besides
> basic find?
>
> Thanks
> Jon
>
>
>
> Sent from my BlackBerry® smartphone with Nextel Direct Connect
>
>
>
> -- 
> Check out my LEGO blog at http://www.brickpile.com/
> View my photos at http://flickr.com/photos/billward/
> Follow me at http://twitter.com/williamward


Reply via email to