VB Help in deletion of files & Folders. 
Author Message
 VB Help in deletion of files & Folders.

I am not a VB programmer, but I do have access to the software on my
computer. What I want to do is have the ability to code a small program that
will navigate to different drives and folders (which I specify) and delete
specific extensions and complete folders.

A direction and any help would be appreciated.

Thanks.



Sat, 17 Jul 2004 06:01:39 GMT  
 VB Help in deletion of files & Folders.
DeleteFolderList("C:\scripts\")

Function DeleteFolderList(folderspec)
   Dim fso, f, file As file, folder, FolderFiles
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)
   Set folder = f.Files
   For Each file In folder
      If LCase(FileExt(file.Name)) = "vbs" Then
      FolderFiles = FolderFiles & file.Name
      FolderFiles = FolderFiles & vbCrLf
      file.Delete
      End If
   Next

   MsgBox "Deleted " & vbCrLf & FolderFiles
   Set fso = Nothing
End Function

Function FileExt(Filename)
    FileExt = Right(Filename, Len(Filename) - InStr(Filename, "."))
End Function

Bryan Martin


Quote:
> I am not a VB programmer, but I do have access to the software on my
> computer. What I want to do is have the ability to code a small program
that
> will navigate to different drives and folders (which I specify) and delete
> specific extensions and complete folders.

> A direction and any help would be appreciated.

> Thanks.



Sat, 17 Jul 2004 06:37:34 GMT  
 VB Help in deletion of files & Folders.

Quote:
> I am not a VB programmer, but I do have access to the software on my
> computer. What I want to do is have the ability to code a small program
that
> will navigate to different drives and folders (which I specify) and delete
> specific extensions and complete folders.

Here is a like to a reply I made for a similar post a week ago. It contains
the code for a script that can be used via the command line or
interactively. Read the detailed description.

http://groups.google.com/groups?q=%22Harvey+Colwell%22&hl=en&scoring=...
uz8u%24v3oBHA.2244%40tkmsftngp02&rnum=3



Sat, 17 Jul 2004 06:45:32 GMT  
 VB Help in deletion of files & Folders.

Quote:

> I am not a VB programmer, but I do have access to the software on my
> computer. What I want to do is have the ability to code a small program that
> will navigate to different drives and folders (which I specify) and delete
> specific extensions and complete folders.

> A direction and any help would be appreciated.

If you are asking about VB and not VBScript, then you are in the wrong group.

--
torgeir



Sat, 17 Jul 2004 07:55:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB Help in deletion of files & Folders.

2. How do I ban permanently deletion of the deleted items folder

3. Detecting the deletion of an item from a custom public folder

4. File deletion in VB for Windows

5. Deletion of folders after timespan

6. Build XML of folders, sub folders and files from specified folder

7. How to delete folders/files within a folder but not the folder itself

8. How to check file sizes & folder hierarchy

9. reading Folders & files

10. folder & files counter in vb5

11. File&Folder Removal/Recycle Bin

 

 
Powered by phpBB® Forum Software