Subj : Recursively deleting a directory
To : All
From : Nightfox
Date : Thu Sep 03 2009 09:31 pm
Re: File deleting & attributes
By: All to Nightfox on Thu Sep 03 2009 20:50:42
As a follow-up to my last message, if I want to recursively delete a temporary
directory after extracting an archive into it, I thought of a simpler solution.
If in Windows, I could have my script execute the "rd /s /q" command;
otherwise assume *nix and use "rm -rf", as follows:
function deltree(pDir)
{
if (/^WIN/.test(system.platform.toUpperCase()))
system.exec("rd " + pDir + " /s /q");
else
system.exec("rm -rf " + pDir);
}
It does what I want on Windows, but for *nix platforms, I could still see there
being a problem removing the directory due to the directory's permissions. But
if the script created the directory in the first place, would that be a
problem?
Eric
---
� Synchronet � Digital Distortion BBS: digdist.bbsindex.com