![](https://seccdn.libravatar.org/avatar/ef3b20e499e909bd7574513744103ce3.jpg?s=120&d=mm&r=g)
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