Just wondering

S

Steven Burn

Just wondering if it would be possible to convert an existing e-mail form
to;

1. Send the e-mail (as it does now...without problems)
2. Copy one folder on the server, to another new folder

Using the username from the e-mail form, as the new foldername?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
R

Ray at

As long as you have access to the ASP file that's doing these things, sure,
why not?

Ray at work
 
S

Steven Burn

Cheers Ray.

I'm just doing a quick search on aspfaq.com to see if I can find any info
(it not only has to copy the folder, but all contents, including
sub-folders..... which is proving to be a nightmare when using the
Server.MapPath string).

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
S

Steven Burn

Below is the code I am trying to use to copy the folder; (constantly gives
"file not found")

'BEGIN CODE

Dim FSO
Dim fldr
Dim strName
strName = Trim(Request.Form("username"))

Set FSO = CreateObject("Scripting.FileSystemObject")

'Doesn't seem to work either
' If FolderExists(Server.MapPath("\htdocs\users\") & strName) = True Then

If FolderExists(Server.MapPath("users\") & strName) = True Then
Response.Redirect "error.asp"
Else
Set fldr = FSO.CopyFolder(Server.MapPath("temp"),
Server.MapPath("users\") & strName)
End If

'Originally VB code, but tried to convert it to work with ASP aswell (not
sure if it works due to the above issue)
Public Function FolderExists(sFileName)
If IsNothing(sFileName) Then
FolderExists = False
Exit Function
End If
If Len(FSO.GetFolder(sFileName)) Then
FolderExists = True
Else
FolderExists = False
End If
End Function

Public Function IsNothing(sWhat)
If Len(Trim(sWhat)) = 0 Then
IsNothing = True
Else
IsNothing = False
End If
End Function

Set FSO = Nothing
Set fldr = Nothing

'END CODE

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
A

Aaron Bertrand - MVP

Set fldr = FSO.CopyFolder(Server.MapPath("temp"),
Server.MapPath("users\") & strName)

CopyFolder takes a destination folder, not the name you want it to take.
Also, there is nothing to assign to the results. Try the following:

FSO.CopyFolder Server.MapPath("temp"), Server.MapPath("users/")
 
A

Aaron Bertrand - MVP

So, if you need it to take on strName, I think you will need to use
MoveFolder method after it has been copied.

Or, just use the MoveFolder method, and then CreateFolder to rebuild the
temp folder, I guess...
 
S

Steven Burn

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/ht
ml/jsmthFolderExists.asp

I've got the following to create the folder, no problem. However, I am
having a problem.

First of all, I tried the FolderExists code at MSDN (see URL above), to try
and get it to re-direct to error.asp if the folder exists, but it doesn't
appear to work. Anyone have any ideas on how to convert the below to check
if the folder exists, and if it does, re-direct it to the error.asp page?

'BEGIN CODE
Dim FSO
Dim fldr
Dim strName
strName = Trim(Request.Form("username"))
Set FSO = CreateObject("Scripting.FileSystemObject")

ReportFolderStatus Server.MapPath("users" & "\" & strName)

Function ReportFolderStatus(fldr)
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(fldr)) Then
response.redirect "error.asp"
Else
Set fldr = FSO.CreateFolder(Server.MapPath("users" & "\" & strName))
FSO.CopyFolder Server.MapPath("temp"), fldr.Path
End If
ReportFolderStatus = msg
End Function

Set FSO = Nothing
Set fldr = Nothing



'END CODE

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
A

Aaron Bertrand - MVP

If (fso.FolderExists(fldr)) Then

Come on now, where do you define fldr? What happens when you do

response.write "fldr = " & fldr: response.end

?
 
S

Steven Burn

ReportFolderStatus Server.MapPath("users" & "\" & strName) 'fldr path and
name

When doing a Response.Write on the above (fldr), it shows the path as it
should be, without any problems.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
A

Aaron Bertrand - MVP

ReportFolderStatus Server.MapPath("users" & "\" & strName) 'fldr path and
name

When doing a Response.Write on the above (fldr), it shows the path as it
should be, without any problems.

You're confusing me. The above is not represented anywhere by the variable
named fldr ...
 
S

Steven Burn

Thanks everyone but...... I've solved it (for now). Modified the code to the
below;

'BEGIN CODE
Dim FSO
Dim fldr
Dim strName
strName = Trim(Request.Form("username"))

If ReportFolderStatus(Server.MapPath("users" & "\" & strName)) = "1" Then
Response.Redirect "error.asp"
Else
Set fldr = FSO.CreateFolder(Server.MapPath("users" & "\" & strName))
FSO.CopyFolder Server.MapPath("temp"), fldr.Path
End If

Function ReportFolderStatus(fldr)
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(fldr)) Then
msg = "1" 'True
Else
msg = "0" 'False
End If
ReportFolderStatus = msg
End Function

Set FSO = Nothing
Set fldr = Nothing

'END CODE
--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Replace Function 6
Block "HEAD" method? 2
[Perhaps OT] Zip 2
use the oleDBCommand in ASP 2
OT - sending HTML email 2
IIS 4
[OT] Server 2003 + Access 23
Reverse text 78

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top