revDeleteFolder and Lessons Learned..

xbury.cs at clearstream.com xbury.cs at clearstream.com
Fri Jul 8 08:05:51 EDT 2005


Guys,

Why not ask a professional? :) I delete production files in a huge huge 
file system among 20 each day.
I CANNOT make a mistake when i delete these things... We're talking 
banking production...

This is what i use for the past 4 years without ONE error...

It works in NT4, NT2000 and XP. Note that the path furnished needs to be 
"\" and not "/" delimited.

cheers
Xavier

function DeleteDir apath
  if " " is in apath or "&" is in apath and quote is not in apath
  then put quote & apath & quote into apath
  set the itemdelimiter to "\"
  get last item of shrname
  if char -1 of it is quote then delete last char of it
  if "$" is in char -1 of it then
    delete char -1 of it
    if length(it) = 1 or it = "IPC" then return "Danger: trying to delete 
a system share!" && shrname
  end if
  get shell("rd" && apath && "/s /q")
  return it
end DeleteDir


On 08/07/2005 13:58:29 use-revolution-bounces wrote:
>On 8 Jul 2005, at 12:22, Alex Tweedly wrote:
>
>> Chipp Walters wrote:
>>
>>
>>> Hi Dave,
>>>
>>> Well, since I passed revDeleteFolder a single "/" and it tried to
>>> delete (w/out being able to be interrupted) the *entire* hard
>>> disk, I would say it's less dangerous to 'roll your own'. I would
>>> expect revDeleteFolder to take as an argument a valid path,
>>> including drive letter. For instance I would expect:
>>>
>>> revDeleteFolder "C:/"
>>>
>>> to delete the C drive. I don't know why just "/" does it and I'm
>>> afraid to test it with a null, especially since it can't be
>>> interrupted. Anything you roll on your own can be interrupted with
>>> a control-period.
>>>
>>>
>> "/" works  because "/" is a valid directory specifier for Rev. You
>> can do
>>    set the defaultFolder to "/"
>> and it does; you don't need a drive specifier.
>> Come to think of it, you can do it in a Windows shell (or whatever
>> a DOS box is called these days) - "cd \"  works.
>
>Interesting, as
>there is a folder "/"
>returns false on XP and true on OS X. Which could prove an insidious
>danger.
>
>
>> I think it would be good to have an optional parameter pConfirm
>> which would require a user confirmation for each directory (or
>> maybe even each file ?). That would make it much more "comfortable"
>> to develop and test an application without fear of inadvertently
>> passing a bad starting directory, and the parameter could be
>> reverted to (the default of) "off" before shipping.
>
>Sounds good.
>
>Cheers
>Dave
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
subscription 
>preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution


-----------------------------------------
Visit us at http://www.clearstream.com
                                                          
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents of
this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you are
not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. Any views expressed in this e-mail are
those of the individual sender, except where the sender specifically
states them to be the views of Clearstream International or of any of
its affiliates or subsidiaries.

END OF DISCLAIMER



More information about the use-livecode mailing list