Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete a directory and all its files
Message
 
To
06/11/2004 12:43:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00958848
Message ID:
00958857
Views:
28
>Hi
>
>Is there a command to delete a Directory also if it is not empty?
>
>Tank you in advance for the help.
>Luigi

You can use Scripting for this, something like:
Function DeleteFolder(tcFolder, tlForce)
LOCAL loFSO, llSuccess

llSuccess	= .F.

IF VARTYPE(tcFolder) = 'C' AND DIRECTORY(tcFolder)
	TRY
		loFSO		= CREATEOBJECT('Scripting.FileSystemObject')
		loFSO.DeleteFolder(tcFolder, tlForce)
		llSuccess	= .T.
	CATCH
	ENDTRY	
ENDIF
RETURN llSuccess
The Force parameter is to force the deletion of any R/O file
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform