Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
Could not remove the folder [Folder name].

Show more details
 Error removing file: Directory not empty

Cancel-Skip All-Skip

I tried to delete these folders from terminal with:

rm -r
share|improve this question
1  
If that error output is from nautilus, you can add a screen-shoot to your question. Also, what is the output of rm -r from terminal? Have you tried with the answers of this post? –  Lucio Mar 15 '13 at 15:50
1  
use rm -rf instead –  nickanor Mar 15 '13 at 16:21
    
I have been used rm -Rf for remove recursively directories, may be this work for you. The uppercase R means Recursive, see man pages man rm –  revnoise Mar 15 '13 at 17:18
    
Do you have permission to remove this directory? Please execute ls -la and paste it here to discard this option. –  revnoise Mar 15 '13 at 17:27
    
The folder was I think deleted first on windows and then tried to delete on Ubuntu. Then tried to delete on Windows but said error. Directory not empty but its all empty promise. On windows it says error Error x00000 –  gabiro Mar 16 '13 at 5:34
add comment

3 Answers 3

Did you try sudo rm -r. What kind of files are there? You could also delete all the files first then delete the folder. Its extra work, but sometimes t worth it to get the job done.

Sudo is for superuser actions.

share|improve this answer
    
I know sudo and the folder has no files inside only a sub folder. Artist Folder then Album Folder no MP3s inside. Just folder. –  gabiro Mar 28 '13 at 14:01
add comment

Go to the folder right before the one you want to delete and execute this command changing foldername by the name of your folder: rm -rf foldername

R means recursive, and f means force.

share|improve this answer
    
rm: cannot remove Wan Pisu - New World': Directory not empty –  gabiro Mar 16 '13 at 5:33
    
Did you use -rf? –  Ramon Suarez Mar 28 '13 at 11:50
    
-rf I think I used rm -r -f -v sir. –  gabiro Mar 28 '13 at 13:59
    
I just did a test with the same directory name and it worked for me, also using your way of separating r f v. Are you sure you are using rm and not rmdir? Did the verbose (-v) give you any clues? Also, are there any 0 byte files within your directory? "rm -r -f -v Wan\ Pisu\ -\ New\ World/ removed 'Wan Pisu - New World/test.test' removed directory: 'Wan Pisu - New World'" –  Ramon Suarez Mar 28 '13 at 16:53
    
no, they are only folders. Also when I'm deleting it on Windows it is Error; 0x----- cannot delete also. -v is explaining what is being done I know rm --help –  gabiro Mar 29 '13 at 12:36
show 3 more comments

I had this same issue with a folder on a btrfs filesystem. Checking mount and lsof normally reveals the cause (You cannot delete a mountpoint while it is mounted). With btrfs also, a subvolume would give a similar issue as the only way to delete a subvolume is to use the "btrfs subvolume delete <path>" command.

In my case I think the issue was a bug. The problem folder was inside a subvolume. I ended up backing up all my data in that subvolume and simply deleting the subvolume entirely. I then restored my data into the subvolume sans the problem folder.

I'm still not sure as to what the issue was - but that was my workaround.

<Update>
The issue was found to be a minor corruption - the folder's i_size was non-zero. Btrfs uses the i_size to tell whether or not the folder is empty. To check this, run:

stat -c %s <foldername>

i_size of an empty folder in btrfs should be zero. In ext I believe it should be 4k.

Related links:
https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#I_cannot_delete_an_empty_directory

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.