Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing A Directory
Message
 
 
À
23/01/2002 09:53:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00608966
Message ID:
00608975
Vues:
18
>I am writing a program that needs to check for the existence of a particular directory. It then needs to delete everything underneath that direcotry (to include other folders) and the very last step is to delete the directory itself.

You need to include paths here if needed:
lnRetVal = adir(laFiles, "*.*")
for i = 1 to lnRetVal
   lcFile = upper(laFiles[i, 1])
   ClearAttributes(lcFile)
   erase (lcFile)
endfor
rd folder_name

procedure ClearAttributes
lparameter tcFileName
if vartype(tcFileName) <> "C" or empty(tcFileName)
   return .f.
endif
local lcFile, lnRetVal
lcFile = alltrim(tcFileName)
DECLARE SHORT SetFileAttributes IN KERNEL32 ;
   STRING @ lpFileName, ;
   INTEGER dwAttributes
lnRetVal = SetFileAttributes(lcFile, 0) && Remove all attributes
return (lnRetVal > 0)
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform