Nov 30, 2009, 9:02 PM
Post #3 of 3
system('rm', '-rf', $directory);
If you use the multiple argument form of system(), you have to go all the way.
By the way, system() calls aren't free. Starting a separate process to execute a command has its own overhead. perl has all the necessary functions to accomplish what you are trying to do without resorting to system(), like the glob operator(you're actually using that but with the old syntax <*>), opendir(), readdir(), File::Path::rmtree(), and rename(). It may be that rm -rf is faster, but unless you know that, and you need the extra speed, stick to perl. The perl functions are going to be portable, while the commands you execute in your system() calls may not be.
(This post was edited by 7stud on Nov 30, 2009, 10:20 PM)