>
oFSO = CREATEOBJ('Scripting.FileSystemObject')
>oFSCRoot = oFSO.GetFolder('C:\Documents and Settings\Roi\My Documents\Projects\US Concrete\Drainage')
>FOR EACH oFolder IN oFSCRoot.SubFolders
> oFolder.Delete(.t.)
>ENDFOR
>
>I get this error: "OLE error code 0x800a004c. Unknown COM status code." when it tries to delete the parent of the " - " folder. Here is the wierd part, if I start on the parent "TestProjects", I don't get the error because it doesn't find a subfolder.
>
Have you tried getting the ShortName for the folder, to see if you can work through the shortname rather than the illegal LFN? If all else fails, I'd try to run a CHKDSK against the affected volume to see if rebuilding the directory indexes helped
>I tried a search at ms's site on that code and the only thing it finds is under "DirectShow" the following error: "CTL_E_PATHNOTFOUND The function attempted to access a file with an incorrect path."
>
>When I try to delete it from explorer I get the error "Cannot delete file: Cannot read from the source file or disk." I can't do anything with it, copy, rename, etc... I always get that same error.
>
>>I haven't tried this, but what about using the FSO as follows (VFP):
>>
>>
oFSO = CREATEOBJ('Scripting.FileSystemObject')
>>oFSCRoot = oFSO.GetFolder('C:\')
>>FOR EACH oFolder IN oFSCRoot.SubFolders
>> IF oFolder.Name = ' - '
>> oFolder.Delete(.t.)
>> ENDIF
>>ENDFOR
This works:
ofso=createo('scripting.filesystemobject')
ofctemp = ofso.getfolder('c:\temp')
ofctemp.subfolders.add(' My Folder')
ofwithspacelead = ofsc.subfolders(' My Folder')
? vartype(ofwithspacelead) && 'O'
=ofsctemp.subfolders(' My Folder').delete(.t.)
ofsctemp.subfolders.add(' - ')
=ofsctemp.subfolders(' - ').delete(.t.)