I've JUST tonight finished writing a program to do this type of task, although it doesn't connect via FTP, but can scan any visible drive. I designed it to scan our terabyte server at work and remove the compounding temp files on there. On its maiden voyage it remoeved some near 12Gb of temp files, about 400,000 files. I'm sure you can amend it to suit your needs.

You can specify any number of files you wanted deleted based on regular expressions in external configuration files. You can also specify entire paths to be removed if you want. It'll test them to make sure they are all older than 7 days. Having these in external files means you can change what you want deleted without having to always be changing the source code.

It'll also output a result of how much space was recovered, files scanned etc. etc.

Its taken me a few months to write as in the process I found that Perl's File::Find module had a memory leak and required me to rewrite the core of the program after I'd completed it the first time. I've also written a Tech Spec for it to give you an overview to the code.

If you want a copy I won't post it here because its some 600 lines long but email me and I'll send you a copy and the tech spec. You may be able to adapt it to your means and make it work with FTP. Or it may just give you some ideas. Considering I started it so long ago I'd probably write it differently now, I'm not overly happy with the code, but it works a treat and I can't be bothered spending any more time on it.

Cheers,
Dean
crabbdean at yahoo.com.au

In reply to Re: using $ftp->mdtm($file) by crabbdean
in thread using $ftp->mdtm($file) by stewartski

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.