This would by necessity be a very platform-specific function, and one which is pretty useless these days, because it only works on ext2 and not on the more modern file systems such as ext3, ReiserFS, XFS, etc. I imagine that these days ext2 is only used on systems that have been in production a long time, or systems which depend on the minimal speed benefit it still enjoys over journaling filesystems. Such systems are unlikely to be handled by someone who is fumble-fingered enough to habitually delete the wrong file, and even then they would normally have backups. If you want to write a Perl wrapper for debugfs, go for it, but I don't imagine it'll get much use.

Anyway, solving this at the filesystem level is the wrong way IMO. If you have users you don't trust to take enough care when deleting, alias the rm command to something that moves files into a temporary directory. IIRC there are some free libraries about which let you do this transparently, so you don't need to mess with shell aliases. And above all, keep backups!


There are ten types of people: those that understand binary and those that don't.

In reply to Re: [OT] undo rm command ?? by tirwhan
in thread [OT] undo rm command ?? by kulls

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.