<% Public Function DeleteIfExists (FilePath) Dim fso, blnDeleted deleted = false Set fso = CreateObject("Scripting.FileSystemObject") if fso.FileExists (Filepath) then fso.DeleteFile (Filepath) blnDeleted = true End if set fso = nothing DeleteIfExists = blnDeleted End Function ' FillSelectFromDir ' e.g usage. ' strImages = "../graphics/product" ' Function DirListing(DirPath) 'Returns an array of directory names in the DirPath Dim fso set fso = CreateObject("Scripting.FileSystemObject") set DirListing = (fso.getFolder(DirPath)).SubFolders End Function Function FileListing(DirPath) 'Returns an array of file names in the DirPath Dim fso set fso = CreateObject("Scripting.FileSystemObject") set FileListing = (fso.getFolder(DirPath)).files End Function Function AbsPath(RelativePath) 'Converts a relative path to an absolute path AbsPath = Server.MapPath(RelativePath) End Function Function FileSelectBox(DirPath, Selected, FirstEntry, FirstEntryValue) 'Generates the content for a HTML Selectbox from a directory Dim strList, fil, strIndent set fil = FileListing(DirPath) strIndent = vbTab strList = "" chk = "" If FirstEntry <> "" then if Selected = FirstEntry then chk = " selected " strList = vbCRLF & strIndent & "" & vbCRLF End if for each item in fil if Selected = item.name then chk = " selected " else chk = "" end if strList = strList & strIndent & "" & item.name & "" & vbCRLF next Set fso = nothing FileSelectBox = strList End Function Function DirectorySelectBox(DirPath, Selected, FirstEntry, FirstEntryValue) 'Generates the content for a HTML Selectbox from a directory Dim strList, fldr, strIndent set fldr = DirListing(DirPath) strIndent = vbTab strList = "" chk = "" If FirstEntry <> "" then if Selected = FirstEntry then chk = " selected " strList = vbCRLF & strIndent & "" & vbCRLF End if for each item in fldr if Selected = item.name then chk = " selected " else chk = "" end if strList = strList & strIndent & "" & item.name & "" & vbCRLF next Set fso = nothing DirectorySelectBox = strList End Function Public Function GetFilename (strFile) GetFilename = Mid(strFile, InstrRev(strFile, "\")+1) End Function %>