Saturday, 26 October 2013

Error removing file: Directory not empty

Something really weird happened today. I transferred some data to my external hard disk and for some reason I unplugged it from my comp without doing 'safely remove drive' (reason being I was lazy :P). Then after sometime I put it back on my laptop and tried removing the directory called Main_Game which I had created earlier. It said 'Error while deleting. Error removing file: Directory not empty'.

Then i tried doing that from terminal using 'rm -rf Main_Game'. Again it didn't work. It said rm: cannot remove 'Main_Game': Directory not empty

Then I thought there might be some process using that folder. So I restarted and tried again. It didn't work :(

Then I thought there might be some error in the filesystem. So I did force fsck.

$ sudo touch /forcefsck
$ sudo reboot

It successfully completed fsck. However the problem wasnt fixed

Then I did something which I should've tried long back and it worked!!

I simply deleted the folder (not force delete). The folder Main_Game was moved to recycle bin. I just deleted from there.

I dunno how this worked though :P


  1. i dint understand anything actually...! but, it was interesting! LOL

  2. I had the EXACT same problem and your solution worked for me. Thanks! ;)