Ben,
If you were to look at the documentation for System.IO.File.Delete()
you'd see that it takes a path to the file you want gone. Path's can
not include wildcards.
You want to do something like:
Dim tFilePath As String = String.Empty
For Each tFilePath In Directory.GetFiles(Server.MapPath("whatever"),
"*.xls")
File.Delete(tFilePath)
Next
You should be aware of a small (I think) bug in the file matching
algorithm Directory.GetFiles() uses. "*.xls" will match all files
who's extension begins with xls. This includes xls, xlsx, xlsa,
xlsux, etc.
-Boo
On Jul 15, 2:24*pm, "Ben" <b...@sdf.sfswrote:
Hi,
i want to delete all excel files together in a specific directory. I tried
this but the syntax is wrong: File.Delete(Server.MapPath("~/excel/" &
"*.xls"))
Can somebody tell me the right syntax?
Thanks
Ben