Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I had a directory called $RECYCLE.BIN which I did not created. I deleted it accidentally and as result all other directories beside it deleted it.

I could not find anything about this directory. Here is :

ben@thebeast ~/Downloads]$ ls
$RECYCLE.BIN
Note.txt
Objective-C Essential Training
[ben@thebeast ~/Downloads]$ rm -r $RECYCLE.BIN
[ben@thebeast ~/Downloads]$ ls
[ben@thebeast ~/Downloads]$

In fact by deleting directory "$RECYCLE.BIN" file Note.txt and directory "Objective-C Essential Training" deleted as well. Does anybody had the same experience or know what is this $RECYCLE.BIN?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

The shell running in Terminal uses $ to identify variables. So if you want to remove or edit (or reference in general) a file whose name contains a $ you need to protect/escape it

rm -r \$RECYCLE.BIN
vi SYS\$OUT.txt

As the variable $RECYCLE most probably didn't exist, the variable got replaced by "nothing" in your case resulting in

rm -r .BIN

being run. This still doesn't fully explain what happened though because all you should have gotten is a rm: .BIN: No such file or directory error.

share|improve this answer
    
I checked history now and I realised that I put a * symbol after $RECYCLE. As you said "echo $RECYCLE*" returned all directories in the current folder which result in deleting everything. Thanks for the great explanation. –  Dane Dec 30 '13 at 22:34
add comment

$RECYCLE.BIN is a hidden folder on Windows systems. It's the Recycle Bin, as you may have guessed. Did you by chance use this disk in a Windows machine at some time? That would explain how it arrived on the disk. Since it's in your Downloads folder, it's more likely that it was accidentally included with a .zip file that you extracted.

share|improve this answer
    
I do not have a Windows installed at my MacBookPro. I never had. But I downloaded many files and it is possible that it came from internet. But how come that deleting that directory cause other directories to be also deleted? Is something wrong with my hard disk? –  Dane Dec 30 '13 at 1:18
add comment

Since it is in your Downloads folder I would bet it was in a poorly compressed file. It could have been compressed with the Note.txt file.

I get the Thumbs.db files all the time, it is created by Windows when it makes the thumbnails and is not removed during compression like hidden files should be.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.