Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > How to delete o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 10983 of 11065
Post > Topic >>

How to delete old directories with perl script?

by a-siehei@[EMAIL PROTECTED] (Siegfried Heintze) Apr 23, 2008 at 08:58 PM

--_000_EB070C90E3B48C4F97C7AC252BACE9E71B45CDF08CNAEXMSGC125re_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I have directory names in the format of "yyyy-mm-dd_hh-mm-ss". Sometimes I
=
want to delete all the non-empty directories that are from last week or
ear=
lier. Other times I want to delete all the directories that are over a
week=
 old.

Is there a script out there already that does this?

Assuming the answer is no, I started writing a script. Unfortunately, the
f=
ollowing does not produce an error and does not work.

$ perl -MFile::Tasks -e
'(File::Tasks->new)->remove_dir("2008-03-11_15-42-5=
8/");

So how would you enumerate the directories, find the ones that are old
(acc=
ording to the above criteria) and delete them and their contents? What
pack=
ages would you use?
Thanks,
Siegfried





--_000_EB070C90E3B48C4F97C7AC252BACE9E71B45CDF08CNAEXMSGC125re_--




 6 Posts in Topic:
How to delete old directories with perl script?
a-siehei@[EMAIL PROTECTED  2008-04-23 20:58:20 
Re: How to delete old directories with perl script?
jialinli1981@[EMAIL PROTE  2008-04-23 23:37:48 
Re: How to delete old directories with perl script?
chas.owens@[EMAIL PROTECT  2008-04-24 00:45:46 
Re: How to delete old directories with perl script?
chas.owens@[EMAIL PROTECT  2008-04-24 00:42:10 
Re: How to delete old directories with perl script?
noreply@[EMAIL PROTECTED]  2008-04-24 08:50:57 
Re: How to delete old directories with perl script?
rvtol+news@[EMAIL PROTECT  2008-04-24 18:17:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 23:30:35 CDT 2008.