Group,
How can you delete a directory in code if it has files in it? (vfp6)
Wade

Re: delete directory by Christof

Christof
Sun Jul 13 13:28:51 CDT 2008

Hi,

Check out Cetin's solution on the MSDN forum. It uses RD and ERASE
recursively to delete all files in the directory.

http://forums.microsoft.com/msdn/ShowPost.aspx?siteid=1&PostID=111127

With the file system object this is a bit easier, if you can rely on it
being installed:

loFSO = CreateObject("Scripting.FileSystemObject")
loFSO.DeleteFolder(lcFolder)
The DeleteFolder() method raises an error when the folder cannot be deleted,
so wrap into a TRY...CATCH or use an error handler.


--
Christof




Re: delete directory by W

W
Sun Jul 13 13:52:49 CDT 2008

Thanks, Christof.... it's working fine so far.

"Christof Wollenhaupt" <msnews.microsoft.com.20050422@prolib.de> wrote in
message news:O68jHZR5IHA.784@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> Check out Cetin's solution on the MSDN forum. It uses RD and ERASE
> recursively to delete all files in the directory.
>
> http://forums.microsoft.com/msdn/ShowPost.aspx?siteid=1&PostID=111127
>
> With the file system object this is a bit easier, if you can rely on it
> being installed:
>
> loFSO = CreateObject("Scripting.FileSystemObject")
> loFSO.DeleteFolder(lcFolder)
> The DeleteFolder() method raises an error when the folder cannot be
> deleted, so wrap into a TRY...CATCH or use an error handler.
>
>
> --
> Christof
>
>
>
>



Re: delete directory by Lew

Lew
Mon Jul 14 05:27:26 CDT 2008

You've got to delete the files & sub dirs first.
"W.Davis" <wdavis3@cinci.rr.comNOSPAM> wrote in message
news:%23Xtf$NR5IHA.4908@TK2MSFTNGP04.phx.gbl...
> Group,
> How can you delete a directory in code if it has files in it? (vfp6)
> Wade
>