[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using tidy + rmdirs to delete a directory and its contents

From: Josh Smith
Subject: Using tidy + rmdirs to delete a directory and its contents
Date: Mon, 10 Jan 2005 09:01:57 -0800

[* I sent this to the list a few weeks ago, but didn't get any replies,
   maybe due to the holidays; trying again now. *]

I'm trying to use tidy and rmdirs to delete a directory and everything in
it, and having some trouble doing so.

I first tried a 'tidy' block with

  /etc/yum.repos.d pattern=* recurse=inf age=0 rmdirs=true 

which worked the first time, but the next run, complained that the
directory wasn't there; and on the run after that, complained

  Couldn't obtain lock for 
lock._var_cfengine_mf_cfengine_cfagent_conf_generic..tidy.tidy_2138 (already 

There's no cfengine/cfagent process running, so it looks like its attempt
(and failure) to delete an empty directory has left a lock somewhere. 
While I suppose this isn't causing any trouble, I mislike "normal errors",
and would rather have it not return an error when nothing is wrong.

I thought this might work:

  /etc pattern=yum.repos.d recurse=inf age=0 rmdirs=true

but it doesn't, because rmdirs only deletes empty directories, and
yum.repos.d isn't empty.

You can't delete the files first, of course, with e.g.

  /etc/yum.repos.d pattern=* recurse=inf age=0
  /etc pattern=yum.repos.d recurse=inf age=0 rmdirs=true

because then the first line complains the second time that there's no such
directory, and the third time that it can't obtain a lock. vaguely implies
that I might want rmdirs=all rather than rmdirs=true, although it's not
very specific about that -- it says "If this option is set to `true' then
cfengine will delete any directories which are empty", but it doesn't say
what it does if the option is set to 'all'.

However, it also doesn't seem to work. :^( I looked through the archives
of this list at and
turned up a fair number of people asking about this, with the answer
generally being "it's a bug, fixed in the latest snapshot", but that was
from back in April. I'm using 2.1.11 on Fedora Core 3, as distributed by
the RPMforge folks. The ChangeLog seems to suggest that this is fixed in
2.1.6, so maybe I'm just doing it wrong somehow...

Thanks in advance for any tips!

                                      -Josh (address@hidden)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]