oh man...I've done it now!

b16ef8300

Registered
Well, I was trying to figure out how to get windows media videos to play in the web browser (I kept getting plug-in missing and things of that nature). In the process of doing this, I trashed some files and an old windows media app. I could not emtpy the trash because of the windows media app (I kept getting a "locked file" error). Anyhow, when looking all over the internet for a solution to emtying the trash, I used the following command in terminal...

% sudo rm -ri ~/.Trash

man that was a BIG MISTAKE! I lost everything...all files on my harddrive....songs, photos, various other documents. Fortunately, I do have MOST of them in another place (most are on cds). My external harddrive crapped out recently and it figures this would happen before I got that fixed!

ah ,well!
 
Maybe there is something I don't know about the trash folder, but I don't quite understand how that could have whipped out everything.

Does the computer still boot or did it just blow your user directory away?
 
The problem is the '.' in relation to '~/'
When specifying '~/.Trash' it's actually interpreted as '~/.' which is the whole home directory.
The correct form when you want to use '~/' in combination with a file/folder starting with '.' is '~/./.Trash'

You can try to use 'cd' in combination with the above and see what happens.
But the -i option ought to have asked you for confirmation ?
 
It's probably too late for you but a friend accidently deleted some files using terminal, after much thought he switched to the finder and went UNDO, unbelievably it worked.
 
BjarneDM said:
The problem is the '.' in relation to '~/'
When specifying '~/.Trash' it's actually interpreted as '~/.' which is the whole home directory.
The correct form when you want to use '~/' in combination with a file/folder starting with '.' is '~/./.Trash'

You can try to use 'cd' in combination with the above and see what happens.
But the -i option ought to have asked you for confirmation ?

Are you sure about that? The dot in front of the name means that it's a hidden file. I've deleted hidden files without disasterous effects by doing "rm -rf .hidden-files" from within the directory. I don't see how doing it with the path listed ("rm -rf ~/.hidden-files") would be any different. The only way the deletion of the entire home directory could have happened is if there was a space between the dot and the word "Trash".
 
OK, I just tested the scenario with a test user I created on my system. I performed the command "rm -ri ~/.Trash" and it prompted me on whether I wanted to delete everything in the trash, including the .Trash directory! I told it no the first time and then decided to try and perform the command this time with "sudo." This time I did tell it to delete the everything including the .Trash directory.

What I did notice is that whenever I wanted to trash something through the Finder, it wouldnt keep it inside the Trash. Instead, it would want to delete it immediately. I haven't tried logging back in to see the results, but so far that's what I've tested. Everything else in the home directory was left intact.
 
OK, I relogged in as the test user and all seems well. I even tried moving files to the Trash, and lo and behold it's containing the files, so it looks as though the .Trash directory is recreated during the relogin.

It's possible that maybe there was a space in between the dot and the file/directory name.

For the record, I'm doing this on 10.4.3.
 
wow, I didn't realize this would spark so much discussion! I was posting simply to relay the leason I learned in using a terminal command that I DO NOT understand! I really should of checked here first.

Thanks for all of the info everyone. Later
 
b16ef8300 said:
wow, I didn't realize this would spark so much discussion! I was posting simply to relay the leason I learned in using a terminal command that I DO NOT understand! I really should of checked here first.

Thanks for all of the info everyone. Later

There's an old trick in the Linux / Unix / Solaris world (where I come from !!) if you want to rease your hard drive (or someone else's if you are particulatly nasty);

rm -rf /

No confirmation, no second chance, nada... Zaps almost everything off the hard drive (rm = remove, -rf = recursive, all files, / = from the root of the target filesystem).

Of course it requires you to be root first...:)

At the PC show in Sydney a few years ago a vendor was setting up their display of Unix boxes and had them all logged in as root - I typed the command in a terminal screen and before pressing enter called the employee over and pointed to the screen, saying "Aren't you glad I'm a nice guy and didn't press enter ?" - the look of realisation and then horror on his face was priceless !!!

moldor
 
Back
Top