Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting a non empty folder
Message
From
20/09/2004 13:20:11
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00944002
Message ID:
00944082
Views:
16
set safety off
mypath=GETDIR()
IF EMPTY(mypath)
    RETURN .T.
ENDIF
=getfolders(mypath)
IF !DIRECTORY(mypath)
    RETURN .T.
ELSE
   MESSAGEBOX("could not delete the directory: "+mypath)
ENDIF

function GetFolders
    parameters mypath
    local lstfiles[1], dirnum,i
    ? mypath
    dirnum = adir(lstfiles,mypath+"\*.*","D") 
    for i = 3 to dirnum
        if "D"$lstfiles(i,5)
            GetFolders(mypath+"\"+lstfiles(i,1))
        endif
    next
    on error do fileerror
    delete file (mypath+"\*.*")
    rd (mypath)
    on error
return(.t.)

PROCEDURE FILEERROR
    myError = 1
    RETURN
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform