Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot delete directories
Message
From
06/09/2000 02:06:33
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00412707
Message ID:
00412793
Views:
17
>You might try using the Scripting.FileSystemObject; do a GetFolder() on the parent to return a FOlder object, and then iterate through the Folders collection, and deleting the funky directories:
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oParent = oFSO.GetFolder('C:\ParentDir')
cLegalChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.\-_ '
FOR EACH oFolder IN oFSO.Folders
   IF LEN(CHRTRAN(oFolder.Name,cLegalChars,''))>0
      *  Funky name
      oFolder.Delete(.t.)
   ENDIF
ENDFOR
oFolder = NULL
oFSO = NULL
Ed, that was close...THANKS! my first playing around w/WSH. I got this to work on my system - w/a little help from Help (I need to delete all the sub-directories, at this point):
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oParent = oFSO.GetFolder('C:\DelClient')
FOR EACH oFolder IN oParent.SubFolders
   WAIT WINDOW "Deleting Directory: " + oFolder.Name
   oFolder.Delete(.T.)
ENDFOR
oFolder = NULL
oFSO = NULL
I'm assuming that I can just build this routine into an EXE, like any other prg, and it should work on the client's system...hope this works. Will let you know. Thanks again. J
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform