Since you are planning to obliterate files using tools that are unfamiliar to you, it should go without saying that you should be very careful and thorough about error checking -- in the sense that, before you actually do an "unlink" call or something similar, you have tested for failures and unintended/unexpected outcomes.

This isn't really all that hard to do -- one way would be to divorce the File::Find part of the task from the "unlink" part; just build a list of files to be removed, and take a few moments to actually review that list yourself, before you throw in the "unlink" call. (Or, just save that list to a file, and once you've checked it, pass it to a separate one-line script to actually remove the files in the list.)

914 suggested some good earlier discussions. I know of another, which is maybe not directly relevant, but demonstrates how the lack of error checking, combined with lack of understanding about File::Find, can be quite risky: Here's the seeker's post and the explanation of the real problem.


In reply to Re: File::Find question by graff
in thread File::Find question by FireBird34

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.