Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting a non empty folder
Message
De
20/09/2004 13:20:11
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00944002
Message ID:
00944082
Vues:
17
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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform