revDeleteFolder and Lessons Learned..

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Jul 8 09:25:19 EDT 2005


Hi Chipp and others who suggested many ideas,

First, Chipp, I really feel for you in your sorrow.
One day or another, we have all known that one second thing able to  
cause havoc... and all the hours later to put the things right.

Second, I think that a command which deletes a folder *has to* delete  
a folder.
It's us who have to pay attention to a possible devastation.
As for me, I want Rev powerful.

May be, some additional statement could warn when the directory is a  
root directory but I assume that runRev guys would answer "that's  
your problem..." and they would be right.
My two cents.

Le 8 juil. 05 à 04:42, Chipp Walters a écrit :

> Here's an interesting story:
>
> Last night I was working on a 'reset prefs' handler which was to  
> remove all the files in a folder.
>
> It looked something like:
>
> on resetPrefs
>   put lMasterFolderPath & "/" & lProjectName into tFolderToDelete
>   revDeleteFolder tFolderToDelete
> end resetPrefs
>
> lMasterFolderPath and lProjectNames are script locals.
>
> I also have a handler 'checkLocals' which I should've put at the  
> top, but I digress.
>
> 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.


Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list