Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to delet file on last 3 month ? ....

by dominix (Deacon)
on Jan 13, 2004 at 11:28 UTC ( [id://320928]=note: print w/replies, xml ) Need Help??


in reply to How to delet file on last 3 month ? ....

directly from find2perl
#! /usr/bin/perl -w use strict; use File::Find (); use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; sub wanted; File::Find::find({wanted => \&wanted}, '.'); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && (int(-M _) >= 90) && unlink $name; }
warning untested.
update: this example delete file older than 3 months, not within 3 months. just play with int(-M _)>= X AND int(-M _)<= Y for between time slice (X,Y in days).
--
dominix

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found