Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to delte multiple file?
#1
Code:
Dim fso Set fso = CreateObject("Scripting.FileSystemObject") if fso.fileExists("C:\Folder1\Folder2\file.doc")Then fso.DeleteFile("C:\Folder1\Folder2\file.doc") End if

with the help of above code i am able to delete a particular file in a folder.
But suppose in folder2 there are 3-4 doc file with different name and i want to delete them what should i do for this?
Reply
#2
Hello here is a script I wrote to remove all the files from a Folder (I hope it helps):

Code:
Set fso=CreateObject("Scripting.FileSystemObject") CleanPath="C:\Jon_Test_Folder\DeleteFiles\" FileCount=0 For Each file In fso.GetFolder(CleanPath).Files FileCount=FileCount+1 Reporter.ReportEvent micDone, "File_Deleted", " '"&File&"': was deleted " file.delete Next Reporter.ReportEvent micDone, "Files_Deleted", " There where '"&FileCount&"' Files deleted from '"&CleanPath&"' "
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)