Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there and undo rm -rf command? 6

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
is there and undo rm -rf command?

i accidentally typed that from the wrong directory
 
farley,

Sorry but Venkman is the bearer of bad news.

There is both elegance and power in an Operating System that does exactly what you tell it to do when you tell him. However the downside is that if by any chance you do a mistake it can be drastic. Sorry about that.

Gary Haran
==========================
 
Did I say "data back from the data"? Wtf does that mean? ("PC Load Letter!")

I meant "data back from the dead."

-Venkman
 
Yes, and its easy to implement. Here's the steps.

1: find where rm is located on your system (/bin/rm)
2: cp /bin/rm /bin/remove
3: rm /bin/rm # ;-)
4: mkdir ~/.garbage
5: Make a shell script that moves target file(s) to ~/.garbage

There's your "undo". Just move files back from your .garbage directory. to truly remove files, use "remove". Be aware, that many scripts will use rm and fill your .garbage "bin".

Good luck. Prayer also helps ;-)

Please let Tek-Tips members know if their posts were helpful.
 
Just to expand on Krale's tip, I did something similar to that a couple years ago on a server that I'm admining (too many users that don't know what they are doing, and too many typo's). Since the backup directories were filling up too fast, and using too much valuable disk space, I extended my scripts to update a small database and keep track of which garbage folders had files added to the recently, and then had a daily script that would simply delete anything that had been in the trash for more than 2 buisness days. I find that gives the users enough time to realize they deleted that report that the absolutly need,but keeps enough disk space that I don't have to keep shuffling data around.
 
Got to give a star to krale
also get a

Dat-a-Boy !!

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Oh come on, does no one besides farley like my response ;). You have to admit it's much cooler to actually physically inspect the hard drive to recover files than to impelement an Apple/MS/KDE/GNOME type recycle in. I mean it may not be as reliable, but it's a little more mission impossible isn't it?

-Venkman
 
Venkman you had a great response and I like it. Sorry I didn't say it earlier, but at the time I was thinking on how to emplement the garbage. It could be a handy trick

Star for venkman

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top