Replies Back to Article
Delete Dynamically Named Folder
ihave change it like his but it doesnt wors!no error no work!
<%
' Delete folder with record
If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then
Set fso = CreateObject("Scripting.FileSystemObject")
folderpath = Server.MapPath("userpics") 'change to the name the uploads root folder.
folderpath = folderpath & "\" & (request.form("del_folder")) 'change to the name of your hidden field.
If fso.FolderExists(folderpath) Then
Set folderObject = fso.GetFolder(( folderpath) & "\")
folderObject.Delete
end if
Set folderObject = Nothing
Set fso = Nothing
End if
%>
mrx3m@hotmail.com for your suggestions!thnx
James Thank you for your code.
A quick question. my dir name is been called from a database <%=(Recseesee.Fields.Item("imagepku").Value)%>
my directory i want deleted is inside "Uploadimages"
you folderpath = Server.MapPath("..\Uploadimages") 'change to the name the uploads root folder.
When I use your code at present it deletes the "Uploadimages" folder which is something i dont want. how can I add the name the uploads root folder when my value is dynamic.
I have tried
you folderpath = Server.MapPath("..\Uploadimages") & (Recseesee.Fields.Item("imagepku").Value)
only to get an error.
regards
k