[thelist] CreateFolder problem

Rob Smith rob.smith at THERMON.com
Wed Nov 20 15:05:01 CST 2002


This is the segment I wanted to focus on for my reply:

[snip]
I am facing a problem in ASP.
I want to create a folder at the server side.
I am not able to create it.

<%

Function CreateFolderDemo
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder("c:\New Folder")
CreateFolderDemo = f.Path
End Function
[/snip]

Ok, here's a snippet of code from my own working model (which is not in a
function):

dim fs,fname,path
path = "c:\<path>\<more_path>\<even_more_path>\TempOutBox\Promotional.html"
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile(path,true) 'assign a new object the new file
object

My permissions for that folder, for the IUSR_<machine_name> account is full
control. Problems I've had in the past was that my path referenced a folder
on another server in which I used the \\server_name\ format instead of a
local folder. Once I changed the path to be on the same computer (i.e. c:\)
it worked. The script I've provided creates a file, not a folder. I've not
tried to create a folder, but the approach might be the same. If you can't
have the code create a folder for you, you could try using a path like:
"c:\NewFolder\file_I'm_not_going_to_use_because_I_need_to_trick_the_OS_into_
creating_the_folder_for_me_to_store_this_empty_text_file_in.txt"

HTH,

Rob.Smith



More information about the thelist mailing list