Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject : DeleteFile Method

Description: 

This func­tion Deletes a spe­cific file.

Format : 

objectOf­FileSys­te­mOb­ject. Delete­File (file­name [, force])

objectOf­FileSys­te­mOb­ject : As the names says, it’s a FileSystemObject.

Arguments: 
    • file­Name
      • Manda­tory
      • Type:     String
      • Name of the file to delete.

  •     overwrite
    • Optional
    • Type: Boolean ( True: delete the file even if read-only attribute is set , False(default): it not delete the file if read-only attribute is set)

 

Function FnDeleteFile(strFileName)
       Set fso = CreateObject("Scripting.FileSystemObject")

       fso. DeleteFile (strFileName)
End Function

Call FnDelete­File (“c:\New Folder\File1.txt”)

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: