1.

Solve : Delete multiple files?

Answer»

Can anyone help me?? What I am trying to do is Wright a Vbscript that will loop through a LIST of files and delete them. Does any one have any suggestion? I was trying to use loop but I can’t get it to work.Where is this list of files coming from? If an external source, you can read the file and delete the files as you GO. If coming from the same directory you can get a collection of file names and loop thru the collection.

This example will loop thru a collection of files from a directory. There is no filter to keep files you may need so be very careful.

Code: [Select]
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFolder(folderspec)
  Set fc = f.Files
  For Each fs in fc
     fso.DeleteFile fs, TRUE
  Next


Just change folderspec to SOMETHING valid.

Hope this HELPS.



Discussion

No Comment Found