Deleting a Directory

I have a directory under my home directory called: my work. I cannot delete this directory and I want to.

If anyone needs additional information. Please let me know.

Any help you can provide is greatly appreciated.

Any error messages? What are the permissions of the directory and its parent?

As a wild guess, I would say that instead of using the command:

rmdir my work

you need to use the command:

rmdir "my work"

but, without seeing what you tried, what error messages you received, knowing whether or not the directory you're trying to remove is empty, knowing the permissions of the directory to be removed and the permissions of its parent directory and the effective user and group IDs you are using when you try to remove that directory; any guess is just wild speculation.

Actually we have a whole treatise about what to do in such a case. You might want to read it.

I hope this helps.

bakunin

For the record: I was taking a class to on Linux/Unix commands and they showed us how to make directories with spaces and special characters. Here is the error I get when trying to remove the directory:

:/home/Hippie13>rmdir "my work"
rmdir: my work not removed.
No such file or directory

Thank you all again for your help. :smiley:

Try

rmdir -i *"my work"*

Can we see the output from these two

ls -li "*my*work*"
ls -li "*my*work*" | od -x

The output from the latter will be larger hex dump of the characters returned and that should help us see if there are any other odd characters in the file, perhaps a leading or trailing space in the the name or some other undisplayable character.

You may even get away using the following from the output of the first command:-

find . -xdev -inum i-node -exec rmdir {} \;

You will need to insert the i-node number from the output of the ls -li It's usually in the second column. If you are worried, you can run this first to check you get the right directory.:-

find . -xdev -inum i-node -exec echo rmdir {} \;

Does this help you at all?

Robin

I think you mean

ls -li *my*work*

All these techniques are more or less in the article mentioned by bakunin.

I would have done

mv "my work" xxx
rm -rf xxx