I'm just starting to try and learn Perl, but it's a sort of trial by fire situation. I need to create a script right away, to resolve a problem. Were I doing this in the Windows environment instead of Unix, I'd already have the script done and compiled (because in Windows, I use the Winbatch scripting language). But I'm still learning shell scripting, let alone Perl. So I could use a little help. My question is one as two whether or not Perl has the necessary functions for me to be able to create the script in perl. I've been through the built-in function list and I don't see much in the way of file manipulation functions or date/time functions. I need to create a perl script (or a shell script, if it's possible to do it that way, using the tcsh shell) that will examine the contents of the /var/backups/repository directory, find all files and directories that have a name that begins with the characters DATE_ , determine which ones of those it finds are more than two weeks old, and delete the ones that are more than two weeks old. If they are directories, it would first have to delete all the files in that directory and then delete the directory. Can anyone point me in the right direction?

In reply to How do I find and delete files based on age? by macvsog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.