deleting files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vdraceil
    New Member
    • Jul 2007
    • 236

    deleting files

    Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by vdraceil
    Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
    Sure, create a File System Object, and delete the file, something like this should do:

    [CODE=vb]dim obj1 as object
    set obj1 = createobject("s cripting.filesy stemobject")
    obj1.deletefile "c:\file.tx t", true[/CODE]

    HTH

    Comment

    • VBPhilly
      New Member
      • Aug 2007
      • 95

      #3
      Originally posted by vdraceil
      Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
      or, if you dont want to create a filesystemobjec t, use the Kill statement:

      Code:
      Kill "C:\DeadFile.txt"

      Comment

      Working...