Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't delete a folder that starts with a space.
Message
General information
Forum:
Windows
Category:
Troubleshooting
Miscellaneous
Thread ID:
00495553
Message ID:
00495976
Views:
15
>
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.)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform