Author: fotokard | Posted on: 6/8/2008 1:18:47 AM | Views : 352

Hi;

I would like to delete all files from a folder on the server but the following script does not delete at all.

Please tell me what went wrong?  Text1 box show all the file names without deleting files.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim FileArray() As String
        FileArray = Directory.GetFiles("c:\directory\")
        Dim fileName As String
        For Each fileName In FileArray

            fileName= Replace(fileName, "c:\Directory\", "")
            System.IO.File.Delete(Server.MapPath(fileName))

          ...

Go to the complete details ...