> You know, a guy here at my office modified the trashClean script and made
> it work significantly faster. His change was quite simple: He realized
> that this script seemed to be kibozing recursively through directories and
> deleting everything in them. So, he replaced that whole function with one
> system call: rm -Rf trash/. Does anyone know of any reason why this
> wouldn't work? We've left it that way for several days and it seems to
> work just fine, and takes about 1/10th as long.
There are several issues (nothing is simple is it?).
First, rm -Rf trash/ actually removes the trash directory. Not a good
thing. Ok, it will be recreated later, but there are potential race
Alternatively, rm -Rf trash/* won't remove the directory, but it will
give output "rm: No match." if the directory is empty (depending upon
which shell you use). Correctly handling stdout/stderr from subcommands
takes some coding effort.
In general I wanted to minimze external dependencies, since command
options vary by OS etc. And all BackupPC subcommands avoid using the
shell for improved security. So I decided to do this in native perl
even at the expense of performance.
If someone is worried enough about this they are welcome to send a
patch, but be aware it will have to be robust, configure.pl will
need to find the path to rm (absolute paths only!), and config.pl
will need a new config variable to hold the rm path.