Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I have a stubborn folder that someone must have created accidentally and that has persisted all this time. I can see it with:

# find /var/www/html -maxdepth 1 -type d

which gives me:


unfortunately the question mark there is not the actual character ?, it merely seems to denote that there is no proper glyph and/or translation for that character. So something like rmdir is out of the question. My system has UTF-8 as the default locale as so many modern Ubuntu systems, but admittedly the folder in question may have originated on a RHEL or CentOS box (tared up and unpacked).

# env|grep LANG

When trying to cd .\? (as mentioned before it is not actually ?) I get auto-corrected to . by bash and actually end up in /var/www/html/. for some reason. Now if I can't "name" this folder usefully, I cannot access it in any way. How can I get rid of it without putting the whole system in jeopardy?

Now I installed detox already but that only seems to act on files, not folders, according to its documentation and besides it still requires that I be able to name the object somehow to do something with it.

share|improve this question
If you change directories to /var/www/html and type ls -aldo any hidden directories show up starting with a .? Like .cache or .config or someting with a . in front – Scott Stookey Feb 29 '12 at 19:08
rm -i makes rm prompt for confirmation of any file. Just press n for all but that one. – Rinzwind Feb 29 '12 at 19:15
@ScottStookey: the folder in question shows up as .? just like before. Observe: drwxr-xr-x 2 user user 4096 2007-09-03 10:08 .? – 0xC0000022L Feb 29 '12 at 19:17
@Rinzwind: spot on. Thanks so much. Could you please write this up as an answer? Did # rm -ir * then got asked: rm: remove directory .\n'?` which I responded to with a y :) – 0xC0000022L Feb 29 '12 at 19:19
up vote 2 down vote accepted

A few suggestions, first try using tab completion

cd /var/www

rm -rf ./.TabTab

Or use find

cd /var/www
find -maxdepth 1 -type d -exec rm -ri '{}' \;

If that fails, try running fsck (from a live CD).

Post any error messages or odd behavior you get

share|improve this answer
sorry, the first one wouldn't work either way because it uses the same mechanisms I mentioned before rm -rf ./.<TAB><TAB> gives me ./ ../ as options. The second would also remove all other other subfolders. – 0xC0000022L Feb 29 '12 at 19:15
the second one does not remove all other subfolders. the i in rm -rfi will invoke a yes/no question before deleting ;) – Rinzwind Feb 29 '12 at 19:17
@Rinzwind: got you, because of the i in there ... so he was slightly earlier then. Will accept this answer then. – 0xC0000022L Feb 29 '12 at 19:20

rm -i * makes rm prompt for confirmation of any file. Just press n for all but that one and press y for the one you want removed.

You can also guess the amount of chars with rm -i .??? for 3 chars (so you do not risc pressing y once too many).

share|improve this answer
Thanks. Also thanks for pointing out my misconception about the other answer :) – 0xC0000022L Feb 29 '12 at 19:22
you are welcome! just keep bodhi.zazen's answer. It's a bit longer than needed as you can see but it's a good answer :) – Rinzwind Feb 29 '12 at 19:23

If you have only this two directories


under /var/www/html/, you can remove the one not named files with the command

find . -mindepth 1 -maxdepth 1 ! -name files -exec rm -rf {} \;
share|improve this answer
Hehe, I am aware of this ugly workaround, but I think the question itself is interesting, because in many cases you may not have a single folder in there ... – 0xC0000022L Feb 29 '12 at 19:21

Your Answer


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.