|
-
Jul 11th, 2001, 02:17 PM
#1
Thread Starter
Hyperactive Member
File System Object and copying a folder...
How can I create a form that will make a new folder named whatever I type in a textbox and copies some files from another location to the new folder? Confusing? Let me try again.
You type "Frank" as the name in a textbox and click continue. The next page creates a folder named "Frank" in a specified directory on the server and copies files from another folder "RootFiles" to the "Frank" folder.
I'm not very good at explaining it, I'm sorry.
Thanks for your help.
If you think education is expensive, try ignorance.
-
Jul 11th, 2001, 06:51 PM
#2
Lively Member
Code:
dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.CreateFolder("new folder")
fso.CopyFile "orignial_path","new path"
Should be working...
-
Jul 11th, 2001, 07:18 PM
#3
Thread Starter
Hyperactive Member
Thank you.
I have been playing with this and it's working great. I changed one thing to CopyFolder instead of Files but the same concept pretty much.
One question though - I can't use Server.MapPath(...)? If so what would you do when being hosted through an ISP where you don't know the static path to write?
Thanks again for any help.
If you think education is expensive, try ignorance.
-
Jul 11th, 2001, 07:24 PM
#4
Lively Member
You should be able to use it... I've used it and it worked perfect.
-
Jul 11th, 2001, 07:32 PM
#5
Thread Starter
Hyperactive Member
Could you please tell me where I'm messing up? I can't find it.
Code:
<%
If Request.Form("Username") = "" Or IsNull(Request.Form("Username")) Then
%>
<form action="Default.asp" method="Post">
<input type="Text" name="Username">
<input type="Submit" value="Sign Up">
</form>
<%
Else
Dim fso
Dim rootFolder
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.CreateFolder(Server.MapPath("/" & Request.Form("Username")))
fso.CopyFolder(Server.MapPath("Test"), (Server.MapPath(Request.Form("Username"))), True)
Response.Write("Thank you " & Request.Form("Username") & ", your account has been created")
End If
%>
There error I get refers to the last paren in the CopyFolder line and says I can't use parens when calling a sub.
Thanks for any help.
If you think education is expensive, try ignorance.
-
Jul 11th, 2001, 07:43 PM
#6
Lively Member
Hmm.. why the true?
Try removing ,True) and the ( before the target-folder...
-
Jul 11th, 2001, 08:06 PM
#7
Thread Starter
Hyperactive Member
Thank you. With a little touching up that fixed it.
Thanks again.
If you think education is expensive, try ignorance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|