I hope this isn't too trivial, but for some reason I can't get a simple command to execute.

I'm writing a file manipulation script and I have several directories called test, test2, etc each containing several files.
I type:
rmdir --ignore-fail-on-non-empty test*

I get a prompt with no error messages as if the command executed cleanly. I ls the directory I'm in and get:
test test2 test3 test4

I know I'm missing something obvious; anyone have a clue what it is? Yes, I'm in the parent directory. Yes, the option is typed correctly -- I checked the manpage twice.

link|improve this question

Solved by doing rm -r test* but I still want to know what's wrong. :-) – Yitzchak Aug 10 '11 at 17:22
Does running it with --verbose shed any light on the situation? – EBGreen Aug 10 '11 at 17:22
if you want to ignore failing on empty, why not rm -rf test*? (edit: nevermind, you just commented about having fixed it) – EricR Aug 10 '11 at 17:22
@EricR Why f? Doesn't the f option go up? I don't think I'd want that. – Yitzchak Aug 10 '11 at 17:24
@Yitzchak "-f ignore nonexistent files, never prompt". afaik there's no option to ascend with rm. – EricR Aug 10 '11 at 17:26
show 1 more comment
feedback

3 Answers

up vote 5 down vote accepted

rmdir --ignore-fail-on-non-empty does exactly what it says on the tin, it ignores failures when not empty; i.e., it does nothing.

An alternate solutions to your problem would be rm -r or rm -rf , using -f in order to "ignore nonexistent files, never prompt".

link|improve this answer
This is the best answer, it explains the ambiguity of the man page. @EricR, I would add other ways to do what the OP wants to do (rm -rf) – MaxMackie Aug 10 '11 at 17:38
@MaxMackie, fixed. I had left them in the comments. – EricR Aug 10 '11 at 17:58
feedback

rmdir removes empty directories. It does not remove non-empty directories. There is no way to make it remove non-empty directories.

link|improve this answer
feedback

rmdir does not remove non-empty folders at all.

Use rm -rf ./test* for this. But be very careful about the path you give rm

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.