Create a folder

This is a useful thing to know how to do , a practical example would be if people were uploading files and wanted to put them in a different directory or if you had a web site and wanted to split it into sections for other people . This example will create a folder called sample on your D drive.

<%
Dim objFSO
'create an instance of the File system object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'create a folder on the D drive called sample
objFSO.CreateFolder("d:\sample")
'if folder exists then display a message
If objFSO.FolderExists ("d:\sample") Then
Response.Write "Folder exists"
'if it doesnt display a different message
Else
Response.Write "folder does not exist"
End If
'destroy object
Set objFSO = Nothing
%>

 

Sponsors