
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.