Re: deleting *.doc in asp.net

Tech-Archive recommends: Fix windows errors by optimizing your registry



off the top of my head try something like this :

DirectoryInfo dir = new DirectoryInfo(@"c:\tmp");
FileInfo[] docfiles = dir.GetFiles("*.doc");

Foreach( FileInfo f in docfiles)
{
File.Delete( f.Name)
}

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Stimp" <ren@xxxxxxxxxx> wrote in message
news:slrndo111i.umi.ren@xxxxxxxxxxxxxxxxxxxxxxxxx
>I want to delete all my .doc files in a specific directory.
>
> I tried to do this using the File.Delete method, but it doesn't allow
> "*.doc" paths.
>
> So I tried the following code:
>
> Dim objFSO = Server.CreateObject("Scripting.FileSystemObject")
> objFSO.DeleteFile(Server.MapPath("*.doc"))
>
> and it works on my local pc, but I doubt I should be using classic asp
> components with asp.net.. what was is the equivalent function in
> asp.net?
>
> Cheers.
> --
>
> fiddlewidawiddum


.



Relevant Pages