in reply to command using system

No need to go to the system,

while (</path/to/*>) { unlink $_ if -f and -M >= 30; }
The -f test is important, you don't want to unlink a directory.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: command using system
by Anonymous Monk on Feb 02, 2004 at 21:56 UTC
    what if I am deleting directories as well ?

      rmdir, after emptying.

      After Compline,
      Zaxo

      I suspect you want a second pass to remove empty directories (or after the unlink, check if that was the last file in the directory and unlink it). I very much doubt you want to remove directories with a modification time < 30 days ago, since they could very well have files with more recent modification dates.