Delete directory

Shari shari at gypsyware.com
Thu May 31 18:11:01 EDT 2007


It goes thru and deletes all files in the directory before attempting 
to delete the directory.  The file deletions are successful, but the 
directory itself remains stubbornly in existance.  The failure is on 
OSX.  Any suggestions?

       if there is a directory myDir then
         delete directory myDir
         if the result is not empty then
           if gPlat is "X" then
             get shell("rm -rf" && q(myDir))
           else if gPlat is "W" then
             set the itemDel to "/"
             put item -1 of myDir into tFile
             put "\/:*?" & quote & "<>|" into tSpecialChars
             repeat for each char tChar in tSpecialChars
               replace tChar with ("-") in tFile
             end repeat
             put tFile into item -1 of myDir
             replace "/" with "\" in myDir
             if char 1 of word 2 of the systemVersion = "5" then
               get shell ("rmdir /s /q" && q(myDir,"Win32"))
             else
               get shell ("deltree /Y" && q(myDir,"Win32"))
             end if
           end if
         end if
       end if

function q pWhat
    return quote & pWhat & quote
end q

gPlat of course denotes the platform.

-- 
Windows and Macintosh shareware games
BIackjack Gold
http://www.gypsyware.com



More information about the use-livecode mailing list