Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing A Directory
Message
 
To
23/01/2002 09:53:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00608966
Message ID:
00609001
Views:
35
>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.

Jeffrey,

With the Windows Script Host it's a snap. Once you've verified the existence of the directory with the DIRECTORY() function
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
* lcdir is the directory to delete
oFSO.DeleteFolder(lcdir, .T.)
Note that this deletes the folder, files, any sub-folders completely. IOW, they're not sent to the Recycle bin. The .T. parameter forces the deletion of any read-only files. All other file, including hidden and system folders are deleted regardless.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform