you can use File::Find module to traverse the directory.
I think this module is simulating the unix find command.
On Wed, Apr 23, 2008 at 10:58 PM, Siegfried Heintze (Aditi)
<a-siehei@[EMAIL PROTECTED]
> wrote:
> 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
earlier. 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 following does not produce an error and does not work.
>
> $ perl -MFile::Tasks -e
'(File::Tasks->new)->remove_dir("2008-03-11_15-42-58/");
>
> So how would you enumerate the directories, find the ones that are old
(according to the above criteria) and delete them and their contents? What
packages would you use?
> Thanks,
> Siegfried
>
>
>
>
>


|