Re: Running of rrequested tests - [was Re: Backup problem using "cp"]
On Wed 09 May 2018 at 22:56:48 (-0400), The Wanderer wrote:
> On 2018-05-09 at 16:20, David Wright wrote:
> > On Tue 08 May 2018 at 22:39:55 (-0400), The Wanderer wrote:
> >> What method are you using to delete it?
> >> If you haven't already, I'd recommend trying 'rm -r', *very*
> >> carefully, from a command prompt. (Unless you have an extremely
> >> unusual setup, that should avoid any possibility of an intermediary
> >> "Trash" to need emptying.)
> > As you're deleting a chain of directories, the appropriate command is
> > rmdir.
> When I initially wrote that, I didn't know that the chain of directories
> didn't contain any non-directory items. (In fact, I'm still not 100%
> certain I do know that, although I think I do.)
Fair enough. But the reason I wanted to use rmdir is precisely because
it will only remove empty directories. Any "real" information that
might happen to be present is protected from loss.
> I also wasn't aware that rmdir could operate recursively; looking now, I
> don't see any indication in its man page that it can. Without that, it
> can only be used to delete one directory at a time, not "a chain of
> directories". Even your own solution handles the "chain" part by using
> find - which admittedly is the canonical default-correct way of doing
> recursive operation in an *nix environment, but also adds a layer of
> complexity not present in a simple 'rm -r'.
Yes, by definition, the directories only become empty (and hence
subject to rmdir) when starting at the bottom. find -depth
The problem with using rm -r is that it wipes out any files too.
Also you can't sensibly combine it with -i (beyond the trivial).
So naturally the complexity increases with the care taken.
In summary, those two functions will remove only directories that are
empty, and only prompt for such directories regardless of how deep