<br><br><div class="gmail_quote">On Wed, Mar 27, 2013 at 4:38 AM, Bill Oliver <span dir="ltr">&lt;<a href="mailto:vendor@billoblog.com" target="_blank">vendor@billoblog.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I&#39;m not a fan of trash directories.  They give you a second chance, but<br>
you may end up not really deleting things you wanted to delete.  What<br>
about a simple script something like this?  This is off the top of my<br>
head and not tested (so certainly has a bug or two), but it seems that<br>
you could check with something like this:<br>
<br>
#!/bin/sh<br>
<br>
echo &quot;check?&quot;<br>
<br>
read ANS<br>
<br>
if [ $ANS = &quot;y&quot; ]<br>
<br>
then<br>
<br>
        ls -laR $1 | more<br>
<br>
        echo &quot;continue?&quot;<br>
<br>
        read ANS2<br>
<br>
        if [ $ANS2 = &quot;y&quot; ]<br>
<br>
        then<br>
<br>
                rm -fr $1<br>
<br>
        fi<br>
else<br>
<br>
        rm -fr $1<br>
<br>
fi<br>
<br></blockquote><div><br><span style="color:rgb(0,0,0)">Yes that script will do to prevent accidental deletions in the future. 
Modified it slightly and posting it just in case needed by someone else.
 Thank you :)<br><br>#!/bin/bash<br><br>echo -e &quot;prompt-bf-deletion.sh...\n&quot;<br>
<br>rm_target=$1<br><br>echo &quot;+++Content(s) to be deleted:&quot;<br>ls -laR $rm_target | more<br><br><br>echo -e &quot;\n+++Continue with deletion (y/n)?&quot;</span><div class="im"><span style="color:rgb(0,0,0)"><br>
read ANS<br><br>if [ $ANS = &quot;y&quot; ]; then<br></span></div><span style="color:rgb(0,0,0)">
    rm -fr $rm_target<br>    echo -e &quot;Contents deleted...\n&quot;<br>else<br>    echo -e &quot;Exiting without deletion...\n&quot;<br><br>fi<br><br>exit<br></span><br><br><br><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Of course there are two problems with big deletions.  If you use more, it would get boring hitting the space bar a zillion times, and if you don&#39;t, then you won&#39;t see the files...<div class="im HOEnZb"><br>
<br>
billo<br>
<br>
<br>
On Wed, 27 Mar 2013, Celik wrote:<br>
<br>
</div><div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Wed, Mar 27, 2013 at 1:14 AM, Bruno Wolff III &lt;<a href="mailto:bruno@wolff.to" target="_blank">bruno@wolff.to</a>&gt; wrote:<br>
      On Tue, Mar 26, 2013 at 22:23:29 +1100,<br>
        Celik &lt;<a href="mailto:celik.n.00@gmail.com" target="_blank">celik.n.00@gmail.com</a>&gt; wrote:<br>
            Hi,<br>
<br>
            Had a logic error in my bash script and did &quot;rm -rf *&quot; on my current<br>
            working directory. Any tips for undoing such an error?<br>
<br>
<br>
I&#39;ve done worse. I once did rm -rf .* to try to remove some config files in a home directory. I forgot that .*<br>
matched .. and deleted a lot of stuff I didn&#39;t want to.<br>
<br>
<br>
Bruno, after such an experience, did you come up with an alternative solution to using &quot;rm -rf&quot;?<br>
&quot;rm -i&quot; is good as it prompts before deletion however it becomes tedious if there are a lot of files to be deleted,<br>
hence &quot;rm -rf&quot; seems ideal but dangerous if not cautious :(<br>
Had a look on google, there was one particular recommendation that caught me attention (sorry I don&#39;t have the link). It<br>
was recommended to mv the files (and/or folders) to be deleted into a tmp directory. I&#39;m planning to try that in my<br>
future code, we&#39;ll see how things go.<br>
<br>
Regards,<br>
C<br>
<br>
</blockquote>
</div></div></blockquote></div><br>