Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create folders in my WEB site programmatically

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
here is code I have to read a folders contents
Code:
<%
	Response.Write "Welcome " & session("company")
	
	Dim strPath   'Path of directory to show
	Dim objFSO    
	Dim objFolder 
	Dim objItem   
	Dim strCurrentPage
	
	strPath="./"
	strCurrentPage = session("folder") & ".asp"
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
	
	response.write "<TABLE>" &_
	 	"<tr><TD>Description</td>" &_
	 	"<TD>Size</TD>" &_
	 	"<TD>Date</TD></TR>"
	For Each objItem In objFolder.Files
		if objItem.Name = strCurrentPage then
			'don't add to list
		else
	 		response.write "<tr><TD><A HREF=""" &_
	   		strPath & objItem.Name &_
	  		""">" & objItem.Name & "</A></TD>" &_
	  		"<TD>" & objItem.Size & "</TD>" &_
	  		"<TD>"& objItem.DateCreated & "</TD></TR>"
	  	end if
	Next
	response.write "</TABLE>"
	Set objItem = Nothing
	Set objFolder = Nothing
	Set objFSO = Nothing

%>

DougP, MCP, A+
 
Code:
<%
dim fso
set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists("c:\mynewfolder")=true then
  response.write("Folder already exists!")
else
 set foldername=fso.CreateFolder("c:\mynewfolder")
set foldername=nothing
 
end if
set fso=nothing
%>

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top