Forums
This topic is locked
Creating folder via ASP
Posted 30 Oct 2002 21:28:43
1
has voted
30 Oct 2002 21:28:43 Germán Iurato posted:
Hi,I'm creating an application where users can register and after that access to a personal mailbox. I insert user's data into tha database, and after that I have to create a folder in the server with the name of the user. For example, after Tony registers, my ASP page should create a new folder "c:\users\Tony". How can I do that?
I'm working with ASP Javascript server model.
Thanks,
Replies
Replied 07 Nov 2002 03:25:17
07 Nov 2002 03:25:17 Dave Blohm replied:
ok, I'm a VBScript guy and I'll show you how to do it that way...
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
If Not objFSO.FolderExists("C:\users\Tony" then
objFSO.CreateFolder("C:\users\Tony"
End If
This checks to make sure that the directory doesn't exist because when working with FSO, the script will create (overwrite) the directory no matter if it exists or not...if it doesnt exist, then it is created...you can write your own ELSE statement to handle what happens if the dir DOES exist...
also, you have to make sure that the appropriate user (iusr, everyone...whatever) has WRITE permissions on the parent directory.
If it HAS to be JavaScript, I can't help you.
Doc
Rangewalk Digital Studios
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
If Not objFSO.FolderExists("C:\users\Tony" then
objFSO.CreateFolder("C:\users\Tony"
End If
This checks to make sure that the directory doesn't exist because when working with FSO, the script will create (overwrite) the directory no matter if it exists or not...if it doesnt exist, then it is created...you can write your own ELSE statement to handle what happens if the dir DOES exist...
also, you have to make sure that the appropriate user (iusr, everyone...whatever) has WRITE permissions on the parent directory.
If it HAS to be JavaScript, I can't help you.
Doc
Rangewalk Digital Studios