Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a folder called Trash-1000 and i want to delete it. There are some folders in it which cannot be deleted (do not even know how they were created).

Looks like: Trash-1000\files\Trash-0\files\src\src\src\src\src\src\src\src\src\src\... (... and so on very very deep dir).

I have tried sudo rm -rf Trash-1000 and sudo chmod -R both give "Operation not permitted"

Any help on how to get rid of the folder is much appreciated!


share|improve this question
Did you specify a user with e.g. sudo chmod -R michael:michael Trash-1000? – deed02392 Feb 21 '13 at 7:17
ls -lah Trash-1000/
lsattr Trash-1000/

The first command will show the file and ownership permissions. If they are 000 or root:root, the root user should still be able to remove the file regardless with this command:

The lsattr command above, the second one, will show if there are any attributes set on the file. If you see a -i on the lsattr command, then run this command to unset that attribute:

chattr -i Trash-1000/

This will remove that immutable file attribute. What immutable does would be preventing changing and removing a file. If the file has that set on it, even the root user cannot remove the file and this is my suspicion on what might be happening if you haven't been able to remove it even as the root user (sudo).

share|improve this answer
lsattr and chattr say: Inappropriate ioctl for device While reading flags on Trash-1000/files – Michael Feb 21 '13 at 9:09
What filesystem are you using? – deed02392 Feb 21 '13 at 9:59

You are not supplying a permission to change TO with chmod.

Seeing as you are about to delete them, you should be safe to use

sudo chmod 777 -R
share|improve this answer
If rm is called with sudo, changing the permissions to 777 is redundant because root will always have the privilege of deleting them at this level. – slhck Feb 21 '13 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .