Of course you are correct. I should have added the caveat regarding subdirectories and readonly objects.
Glenn
>Glenn,
>I'm also not a fan of fso and try to avoid it (using filer.dll and winAPI instead). However this command wouldn't work as is (it might contain subfolders, readonly etc). Actually I don't know of a way to do it in pure VFP:) I have a FileIO class that's utilizing filer.dll and winAPI and using taht class I can copy,delete,move etc individual or complete folders (there is an older public version in fox4um site).
>Cetin
>
>
>>You can also remove the directory using "strict" VFP:
>>
>>if directory(cFolder2)
>> lcWasSafe = set('safety')
>> set safety off
>> delete file (addbs(cFolder2)+'*.*')
>> rmdir (cfolder2)
>> if lcWasSafe = 'ON'
>> set safety on
>> endif
>>endif
>>
>>
>>Glenn
>>
>>>Dear Sir,
>>>
>>>I want to remove a folder and use following code but it generates error.
>>>The line on which error appears is the second last line.
>>>
>>>Please modify codes or suggest some other codes to delete any folder.
>>>
>>>
>>>cFolder1 = alltrim(Thisform.text4.value)
>>>cFolder2 = alltrim(thisform.text8.value)
>>>
>>>
>>>fso =createobject("Scripting.FileSystemObject")
>>>aoo= fso.FolderExists(cFolder2)
>>>
>>>
>>>if aoo=.t.
>>>fso =createobject("Scripting.FileSystemObject")
>>>fldr=fso.DeleteFolder(cFolder2)
>>>endif
>>>