revDeleteFolder and Lessons Learned..
Dave Cragg
dcragg at lacscentre.co.uk
Fri Jul 8 04:30:28 EDT 2005
On 8 Jul 2005, at 03:42, Chipp Walters wrote:
>
> In anycase, after applying the script and running, of course the
> script locals are now nulls and the revDeleteFolder contained only
> a single "/", which apparently means: "Delete the entire route hard
> drive".
>
> After running it and seeing the processor shoot to 100% and stay
> there, I guessed something was wrong. I tried to quit it, but it's
> a shell script and even the task manager wouldn't allow me to kill it.
>
> By the time I was able to force shutdown my machine, most the
> entire Windows partition was wasted. Fortunately, my Linux
> partition was still good and I could access my Documents folder and
> grab most of the stuff that mattered, but of course WinXP was
> completely hosed.
>
> My lesson learned is NEVER, NEVER, NEVER use revDeleteFolder. I
> rewrote the script to use 'the files' and delete each file
> individually.
>
> Hope others can learn from my mistake!
My sympathies, Chipp. I bet that hurt.
But I'm not entirely clear of the lesson to be learned. Is the
problem really with revDeleteFolder, or with the nature of script
locals?
If we don't use revDeleteFolder, but we want to delete a folder, then
we have to roll our own routines. This can be plenty dangerous too.
I have my own routine for this using the standard "directories" and
"files" transcript routines. (There was no revDeleteFolder when I was
a lad.) But I also managed to wipe half my hard drive before I got
the routine working. This is a recursive routine, working through all
of the sub-directories. My error was forgetting that the transcript
"directories" function always returns ".." among the list of
folders. The routine worked perfectly, too perfectly. :(
So do we warn people not to use revDeleteFolder, and leave them to
their own potentially dangerous devices. Or simply warn people to be
*extremely* careful when deleting folders and check they are in fact
deleting the intended folder.
Cheers
Dave
More information about the use-livecode
mailing list