FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

ASP Tutorial: Creating folder and file in the server dynamically using asp

jawahar
4/11/2007 2:51:15 PM, Views: 1380
The following code can be used to create a folder and create an asp file(and write some contents into the file) inside the folder dynamically using asp
The below code will check if the specified foldername exists in the server, and if not create a folder and a file inside that folder.

<%
Dim objFSO                ' FileSystemObject
Dim objFdr                ' FolderObject
Dim ObjTS          ' TextStreamObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if not objFSO.FolderExists(server.MapPath("/FolderName")) then
   Set objFdr = objFSO.CreateFolder(server.MapPath("/FolderName"))
   Set objTS = objFSO.CreateTextFile(server.MapPath("/FolderName/index.asp"), True)
   objTS.Write "Sample Data" & vbcrlf
   objTS.Close
   Set objFdr = Nothing
end if
Set objFSO = Nothing
Set objTS = Nothing
%>
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 5 out of 5
Number of Ratings : 1 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
ASP RSS Feed
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Contributors
Yearly
Overall
 
1. jawahar (200)
bnrtop