[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensuse
Subject:    Re: [opensuse] Undoing a delete
From:       Carl Spitzer <cwsiv () myrealbox ! com>
Date:       2007-11-30 0:43:06
Message-ID: 1196383386.5897.19.camel () linux ! site
[Download RAW message or body]

On Sat, 2007-11-17 at 16:40 -0600, Bryen wrote:
> Is there any way to undo an rm in terminal?  Probably not, but thought
> I'd ask...
> 
> 
> -- 
> ---Bryen---

#!/bin/sh
#
#MoveWithPWD
#You must translate the slash or the move will fail.
#
MyPWD=`echo $PWD | tr '/' '-'`
#echo $MyPWD
#
#In the for loop you specify the files you wish this gets them all
#See man ls
#
for i in `ls -A`; do
   mv -v $i /home/<user>/.Trash/$MyPWD.$i;
done





to list the files if you choose minus for the translation of the /
The double dash must be after the minus l in order for the command
to know to handle files starting with a minus.


ls -l  -- -*
-rw-------  1 cwsiv users 15416571 2007-11-29 16:26
-home-cwsiv-test.dummy.071111
-rw-------  1 cwsiv users  7771751 2007-11-29 16:26
-home-cwsiv-test.dummy.071112
-rw-------  1 cwsiv users  9933056 2007-11-29 16:26
-home-cwsiv-test.dummy.071113
-rw-------  1 cwsiv users  8629139 2007-11-29 16:26
-home-cwsiv-test.dummy.071114
-rw-------  1 cwsiv users 11471762 2007-11-29 16:26
-home-cwsiv-test.dummy.071115
-rw-------  1 cwsiv users  9405675 2007-11-29 16:26
-home-cwsiv-test.dummy.071116


All my scripts started as other peoples ideas modified many times for my
own needs.  This is the best I could do on short notice.  Of course you
will have to put this under some directory on your user and make a alias
for rm in either dot profile or dot bashrc referring to this script.

So now you have your first script enjoy it in good health and have some
fun with it, on test data.  

Likely someone here will provide you a reversal script for restoring
single files from .Trash to their original locations.



 ___ _ _ _ ____ _ _  _
|    | | | [__  | |  |
|___ |_|_| ___] |  \/
 

-- 
To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse+help@opensuse.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic