[QUOTE=dwoeltje;4299]Basically, I’m attempting to do the following but it errors out so it must not be possible this way. However, there must be some alternate way of accomplishing it. I just need a little assistance.
This is what I tried to do:
find /var/log/audit -mtime 5 | rmdir --ignore-fail-on-non-empty
I’m trying to get rmdir to use the output of the find command as input for removing directories that are not empty and are more than 5*24 (in other words, 5 days) old.[/QUOTE]
In addition to Malcom’s answer - the original command did not work for multiple reasons:
The used syntax makes the output of the first command the “standard input” of the second command, not its parameters… you might have accomplished that via “rmdir --ignore-fail-on-non-empty $(find /var/log/audit -mtime 5)” in a bash script (other shells may use a different syntax).
But still, “rmdir” will only remove empty directories. “–ignore-fail-on-non-empty” will simply not report non-empty directories as errors, so that you can invoke it with i.e. wildcards and still check it’s rc for “more severe causes of failure”. So, non-empty directories are preserved.