|
-
Sep 9th, 2000, 04:22 PM
#1
Thread Starter
PowerPoster
I'm working on an app which in some cases creates subfolders below "App.Path" (got that part working fine) and in some cases I want to go through and delete all such subfolders (each subfolder is named with a specific pattern). The second part is where I'm stuck. I would like to use the FSO; I've used it a little bit and would like to use it more. I envision the pseudocode for this thing as something like the following:
Code:
'pseudocode:
For Each Subfolder In (App.Path)
If Subfolder.Name Like "MyPattern" Then
fso.DeleteFolder Subfolder.Name
End If
Next
Can someone help and substitute the pseudocode with the proper VB syntax? I would be eternally grateful ...
"It's cold gin time again ..."
Check out my website here.
-
Sep 9th, 2000, 04:36 PM
#2
_______
<?>
Code:
'this will kill all sub folders in C:\My Documents
Option Explicit
Sub ShowFolderList(folderspec)
Dim fs, f, f1, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set sf = f.SubFolders
For Each f1 In sf
s = f1.Name
fs.Deletefolder (folderspec & "\" & s)
s = s & vbCrLf
Next
End Sub
Private Sub Image1_Click()
Call ShowFolderList("C:\my documents")
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 04:48 PM
#3
Thread Starter
PowerPoster
Thanks Wayne, I appreciate the help. If you don't mind, here's a follow-up question. I know that in VBScript, all variables are variant, but in straight VB, what would you DIM these variables as? I know that "f" and "f1" would have to be "Folder", but how about "sf"?
"It's cold gin time again ..."
Check out my website here.
-
Sep 9th, 2000, 05:08 PM
#4
_______
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|