Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Paul Gibson
  Where is Paul Gibson?
 Glasgow
 United Kingdom
 Paul Gibson
 To: Koen Piller
  Where is Koen Piller?
 Santpoort-Zuid
 Netherlands
 Koen Piller
 Tags
Subject: RE: remove directory
Thread ID: 373496 Message ID: 373501 # Views: 64 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Classes and Objects
Date: Friday, March 22, 2013 4:16:25 PM         
   


> Hi,
>
> do we have a syntax to remove a directory and all its subs, even if there is data in any? For OS WIN7
>

Try the File System Object. Can't guarantee it's always available 100% of the time but I've never come across an occurrence where I could not use it:

********************************
* Function: DeleteFolder
* Parameter: tcFullPath
********************************
Function DeleteFolder
	Lparameters tcFullPath

	Local lnReturn, llDeleted

	m.tcFullPath = Evl(m.tcFullPath, "")

	m.goFSO = Createobject("Scripting.FileSystemObject")
	Try
		m.llDeleted = m.goFSO.DeleteFolder(Justpath(Addbs(m.tcFullPath)))
		m.lnReturn  = Iif(m.llDeleted, 1, -1)
	Catch
		m.lnReturn = -2
	Endtry

	Return lnReturn

Endfunc && DeleteFolder


If you don't want to use that then just write a recursive function that can go through all sub folder of a directory, deleting everything within before deleting the parent folder.

ENTIRE THREAD

remove directory Posted by Koen Piller @ 3/22/2013 3:47:27 PM
RE: remove directory Posted by Rick Hodgin @ 3/22/2013 4:14:18 PM
RE: remove directory Posted by Paul Gibson @ 3/22/2013 4:16:25 PM
RE: remove directory Posted by Samir H. @ 3/24/2013 8:28:18 AM
RE: remove directory Posted by Koen Piller @ 3/24/2013 1:40:08 PM
RE: remove directory Posted by Samir H. @ 3/24/2013 3:04:26 PM
RE: remove directory Posted by Koen Piller @ 3/24/2013 5:07:28 PM
RE: remove directory Posted by Rick Hodgin @ 3/24/2013 7:13:54 PM
RE: remove directory Posted by Koen Piller @ 3/24/2013 9:15:33 PM
RE: remove directory Posted by Rick Hodgin @ 3/24/2013 9:46:27 PM
RE: remove directory Posted by Koen Piller @ 3/24/2013 10:32:17 PM
RE: remove directory Posted by Rick Hodgin @ 3/24/2013 10:35:50 PM
RE: remove directory Posted by Rick Hodgin @ 3/24/2013 10:43:07 PM
RE: remove directory Posted by Koen Piller @ 3/24/2013 10:50:04 PM
RE: remove directory Posted by Rick Hodgin @ 3/24/2013 10:54:13 PM