VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code deletes folders and files. the only thing you have to do is to provide the program a path

by Barabas Andrei (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 7th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code deletes folders and files. the only thing you have to do is to provide the program a path to that file or folder and to tell him if

Rate This code deletes folders and files. the only thing you have to do is to provide the program a path



'This module is brought to you by Barabas Andrei
'It is freeware, but you'll have to use it with
'this header.
'How it works:
'It deletes files and folders. You just have to provide a
'path and to tell the module if the path points to a folder
'or to a file
'Ex: Delete("c:\windows",1) {deletes the folder(the number 1
'represents the folder)}
'Ex: Delete("c:\windows\setup.bmp",0)  {deletes the file(the number
'0 stands for file
'Please enjoy
'if you have any trouble with this module please e-mail me

Public Function Delete(ByVal path As String, ByVal Mode As Integer)
       If Mode = 0 Then
          Set fs = CreateObject("Scripting.FileSystemObject")
          fs.deletefile path
       ElseIf Mode = 1 Then
            Set fs = CreateObject("Scripting.FileSystemObject")
            fs.deletefolder path
       End If
End Function

Download this snippet    Add to My Saved Code

This code deletes folders and files. the only thing you have to do is to provide the program a path Comments

No comments have been posted about This code deletes folders and files. the only thing you have to do is to provide the program a path. Why not be the first to post a comment about This code deletes folders and files. the only thing you have to do is to provide the program a path.

Post your comment

Subject:
Message:
0/1000 characters