473,554 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

take hostname, look if folder exsist, if not create and copy files

Paw
Greetings.
I use asp.
what I need is is when a visitor comes to the site, I need it to check
the host name. if "www.hometowndi gest.com" is the host, then check a
folder named "something" and if the folder does not exsist, create
folder "www" and then copy folder "temp" and its contents.

If the folder "www" is there, look in it, check to see if the files in
folder "temp" are in there, if not, copy the files that are not from
folder "temp" into folder "www".
If instead of www.hometowndigest.com, it is
"vbscript.homet owndigest.com", I need it to do the same rountine. What
ever the subdomain name.
This file will be be drawn as an include file.
NOTE:
1. I do not need it to look in folder "Temp/www" or folder
"temp/vbscript", etc, only folder "temp"
2. Please note further includes along the way in the file will run
script. So, if it could not interfer with those by some kind of
statement.
3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
do nothing.
4. If the script cannot or would be too consuming of time or resources,

maybe i can manually add a listing of the files to look for in the
script through
Thanks in advance.
Paw.

May 29 '06 #1
8 2561
From: "Paul Chambers" <ha******@comca st.net>
Newsgroups: microsoft.publi c.scripting.vbs cript
Subject: Re: create folders and files if...
Date: Tue, 30 May 2006 07:34:56 -0000

Please note I posted this elsewheres. Please anwser at
http://groups.google.com/group/micro...d87b0880a6eda0
I apoligize.
Paul

May 30 '06 #2

Paw wrote:
Greetings.
I use asp.
what I need is is when a visitor comes to the site, I need it to check
the host name. if "www.hometowndi gest.com" is the host, then check a
folder named "something" and if the folder does not exsist, create
folder "www" and then copy folder "temp" and its contents.

If the folder "www" is there, look in it, check to see if the files in
folder "temp" are in there, if not, copy the files that are not from
folder "temp" into folder "www".
If instead of www.hometowndigest.com, it is
"vbscript.homet owndigest.com", I need it to do the same rountine. What
ever the subdomain name.
This file will be be drawn as an include file.
NOTE:
1. I do not need it to look in folder "Temp/www" or folder
"temp/vbscript", etc, only folder "temp"
2. Please note further includes along the way in the file will run
script. So, if it could not interfer with those by some kind of
statement.
3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
do nothing.
4. If the script cannot or would be too consuming of time or resources,

maybe i can manually add a listing of the files to look for in the
script through
Thanks in advance.
Paw.


So what is your question? Which bit are you having difficulty with?

--
Mike Brind

May 30 '06 #3
Paw
Thank You for your response.
here is the code I have so far. Not working though. Paul Chambers

<%

'+--------------------------------------------------------------+
'| FOLDERS |
'+--------------------------------------------------------------+

DIM ROOT_PATH : ROOT_PATH = server.MapPath( ".")
Dim LOCAL_FOLDER : = Root_path & "\local"

LOCAL_FOLDER = LOCAL_FOLDER & "\" &
mid(Request.Ser verVariables("S ERVER_NAME"),1 ,instr(1,
Request.ServerV ariables("SERVE R_NAME"), ".")-1)
'+--------------------------------------------------------------+
'| LOCAL CREATED FILES PATH |
'+--------------------------------------------------------------+
DIM SUB_PATH : SUBL_PATH = ROOT_PATH & LOCAL_PATH & "\default.a sp"
DIM OTHERL_PATH : OTHERL_PATH = ROOT_PATH & LOCAL_FOLDER & "\user.asp"


%>

<SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">

'============== =============== ===========
'---- Checks if the Sub files exist ----
'============== =============== ===========
' if not copy from the default one
'============== =============== ===========
'transform that as jscript
Sub CheckAllFiles()
Dim sText
Dim objFSO : Set objFSO =
server.CreateOb ject("scripting .Filesystemobje ct")
Dim objFile
Dim arrFolders
Dim arrFiles
Dim i

'We create missing folders
arrFolders = array(LOCAL_FOL DER)
for i=0 to uBound(arrFolde rs)
If not objFSO.FolderEx ists(arrFolders (i)) Then
objFSO.CreateFo lder(arrFolders (i))
End if
next

'We create missing files
If NOT objFSO.FileExis ts(SUB_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \default.asp", 1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(SUB_PATH , True)
Call objFile.Write(s Text)
Set objFile = nothing
End If

If NOT objFSO.FileExis ts(OTHERL_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH & "\secure\master \user.asp",
1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(OTHERL_P ATH, True)
Call objFile.Write(s Text)
Set objFile = nothing
End If
Set objFSO = nothing

if err<>0 then
err.Clear
Response.Write "<font face=arial><b>W arning :</b> To complete
installation of this SubDomain, you must give write permission to the
database and media directories (under IIS console, and explorer if you use
NTFS).</font>"
Response.End
end if

End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JScri pt" RUNAT="Server">

//=============== =============== =============== =====
// call the vbscrip function with an error trapping
//=============== =============== =============== =====
function JSCheckAllFiles ()
{
try
{
CheckAllFiles() ;
}
catch(e) {
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must give write permission to the database and media
directories (under IIS console, and explorer if you use NTFS).</font><br>");
return false;
}
}

//=============== =============== =============== =====
// Save an SUB file with FSO
//=============== =============== =============== =====
function SavesubFile(sFi leName, sContent)
{
var objFSO, objFile;

try
{
objFSO = new ActiveXObject(" Scripting.FileS ystemObject");
objFile = objFSO.CreateTe xtFile(sFileNam e, true, true);

}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must install VBScript runtime version 5.6.</font><br>");
return false;
}
try
{
objFile.Write(s Content);
objFile.close() ;
}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> Can't save xml file.
Check the write permission.</font><br>");
//objFile = objFSO.CreateTe xtFile(sFileNam e + "." + GetGuid(6), true,
true);
//objFile.Write(s Content);
//objFile.close() ;
return false;
}

//Response.Write( sFileName + " is updated.<br/>");
}

</SCRIPT>

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .

Paw wrote:
Greetings.
I use asp.
what I need is is when a visitor comes to the site, I need it to check
the host name. if "www.hometowndi gest.com" is the host, then check a
folder named "something" and if the folder does not exsist, create
folder "www" and then copy folder "temp" and its contents.

If the folder "www" is there, look in it, check to see if the files in
folder "temp" are in there, if not, copy the files that are not from
folder "temp" into folder "www".
If instead of www.hometowndigest.com, it is
"vbscript.homet owndigest.com", I need it to do the same rountine. What
ever the subdomain name.
This file will be be drawn as an include file.
NOTE:
1. I do not need it to look in folder "Temp/www" or folder
"temp/vbscript", etc, only folder "temp"
2. Please note further includes along the way in the file will run
script. So, if it could not interfer with those by some kind of
statement.
3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
do nothing.
4. If the script cannot or would be too consuming of time or resources,

maybe i can manually add a listing of the files to look for in the
script through
Thanks in advance.
Paw.


So what is your question? Which bit are you having difficulty with?

--
Mike Brind

May 30 '06 #4
1. How do you define "not work"?
2. Where have you put your response.write statements to check that the
values you expect are actually there?
3. Where are they failing?
4. What error messages do you get, if any?

--
Mike Brind
Paw wrote:
Thank You for your response.
here is the code I have so far. Not working though. Paul Chambers

<%

'+--------------------------------------------------------------+
'| FOLDERS |
'+--------------------------------------------------------------+

DIM ROOT_PATH : ROOT_PATH = server.MapPath( ".")
Dim LOCAL_FOLDER : = Root_path & "\local"

LOCAL_FOLDER = LOCAL_FOLDER & "\" &
mid(Request.Ser verVariables("S ERVER_NAME"),1 ,instr(1,
Request.ServerV ariables("SERVE R_NAME"), ".")-1)
'+--------------------------------------------------------------+
'| LOCAL CREATED FILES PATH |
'+--------------------------------------------------------------+
DIM SUB_PATH : SUBL_PATH = ROOT_PATH & LOCAL_PATH & "\default.a sp"
DIM OTHERL_PATH : OTHERL_PATH = ROOT_PATH & LOCAL_FOLDER & "\user.asp"


%>

<SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">

'============== =============== ===========
'---- Checks if the Sub files exist ----
'============== =============== ===========
' if not copy from the default one
'============== =============== ===========
'transform that as jscript
Sub CheckAllFiles()
Dim sText
Dim objFSO : Set objFSO =
server.CreateOb ject("scripting .Filesystemobje ct")
Dim objFile
Dim arrFolders
Dim arrFiles
Dim i

'We create missing folders
arrFolders = array(LOCAL_FOL DER)
for i=0 to uBound(arrFolde rs)
If not objFSO.FolderEx ists(arrFolders (i)) Then
objFSO.CreateFo lder(arrFolders (i))
End if
next

'We create missing files
If NOT objFSO.FileExis ts(SUB_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \default.asp", 1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(SUB_PATH , True)
Call objFile.Write(s Text)
Set objFile = nothing
End If

If NOT objFSO.FileExis ts(OTHERL_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH & "\secure\master \user.asp",
1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(OTHERL_P ATH, True)
Call objFile.Write(s Text)
Set objFile = nothing
End If
Set objFSO = nothing

if err<>0 then
err.Clear
Response.Write "<font face=arial><b>W arning :</b> To complete
installation of this SubDomain, you must give write permission to the
database and media directories (under IIS console, and explorer if you use
NTFS).</font>"
Response.End
end if

End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JScri pt" RUNAT="Server">

//=============== =============== =============== =====
// call the vbscrip function with an error trapping
//=============== =============== =============== =====
function JSCheckAllFiles ()
{
try
{
CheckAllFiles() ;
}
catch(e) {
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must give write permission to the database and media
directories (under IIS console, and explorer if you use NTFS).</font><br>");
return false;
}
}

//=============== =============== =============== =====
// Save an SUB file with FSO
//=============== =============== =============== =====
function SavesubFile(sFi leName, sContent)
{
var objFSO, objFile;

try
{
objFSO = new ActiveXObject(" Scripting.FileS ystemObject");
objFile = objFSO.CreateTe xtFile(sFileNam e, true, true);

}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must install VBScript runtime version 5.6.</font><br>");
return false;
}
try
{
objFile.Write(s Content);
objFile.close() ;
}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> Can't save xml file.
Check the write permission.</font><br>");
//objFile = objFSO.CreateTe xtFile(sFileNam e + "." + GetGuid(6), true,
true);
//objFile.Write(s Content);
//objFile.close() ;
return false;
}

//Response.Write( sFileName + " is updated.<br/>");
}

</SCRIPT>

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .

Paw wrote:
Greetings.
I use asp.
what I need is is when a visitor comes to the site, I need it to check
the host name. if "www.hometowndi gest.com" is the host, then check a
folder named "something" and if the folder does not exsist, create
folder "www" and then copy folder "temp" and its contents.

If the folder "www" is there, look in it, check to see if the files in
folder "temp" are in there, if not, copy the files that are not from
folder "temp" into folder "www".
If instead of www.hometowndigest.com, it is
"vbscript.homet owndigest.com", I need it to do the same rountine. What
ever the subdomain name.
This file will be be drawn as an include file.
NOTE:
1. I do not need it to look in folder "Temp/www" or folder
"temp/vbscript", etc, only folder "temp"
2. Please note further includes along the way in the file will run
script. So, if it could not interfer with those by some kind of
statement.
3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
do nothing.
4. If the script cannot or would be too consuming of time or resources,

maybe i can manually add a listing of the files to look for in the
script through
Thanks in advance.
Paw.


So what is your question? Which bit are you having difficulty with?

--
Mike Brind


May 30 '06 #5
Paw
1. How do you define "not work"?

I get server 500 error message., files are not being written.

2. Where have you put your response.write statements to check that the
values you expect are actually there?

The code in the last post is the code I have. If not there, I didn't. I
know the folders and files are there with correct permissions.

3. Where are they failing?

Not sure.

4. What error messages do you get, if any?
Don't have access to my server logs.

I did see one typo in the code, I fixed it. Is it ok to attach a txt file to
the post of the code?

Thank you, Paul Chambers

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
1. How do you define "not work"?
2. Where have you put your response.write statements to check that the
values you expect are actually there?
3. Where are they failing?
4. What error messages do you get, if any?

--
Mike Brind
Paw wrote:
Thank You for your response.
here is the code I have so far. Not working though. Paul Chambers

<%

'+--------------------------------------------------------------+
'| FOLDERS |
'+--------------------------------------------------------------+

DIM ROOT_PATH : ROOT_PATH = server.MapPath( ".")
Dim LOCAL_FOLDER : = Root_path & "\local"

LOCAL_FOLDER = LOCAL_FOLDER & "\" &
mid(Request.Ser verVariables("S ERVER_NAME"),1 ,instr(1,
Request.ServerV ariables("SERVE R_NAME"), ".")-1)
'+--------------------------------------------------------------+
'| LOCAL CREATED FILES PATH |
'+--------------------------------------------------------------+
DIM SUB_PATH : SUBL_PATH = ROOT_PATH & LOCAL_PATH & "\default.a sp"
DIM OTHERL_PATH : OTHERL_PATH = ROOT_PATH & LOCAL_FOLDER & "\user.asp"


%>

<SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">

'============== =============== ===========
'---- Checks if the Sub files exist ----
'============== =============== ===========
' if not copy from the default one
'============== =============== ===========
'transform that as jscript
Sub CheckAllFiles()
Dim sText
Dim objFSO : Set objFSO =
server.CreateOb ject("scripting .Filesystemobje ct")
Dim objFile
Dim arrFolders
Dim arrFiles
Dim i

'We create missing folders
arrFolders = array(LOCAL_FOL DER)
for i=0 to uBound(arrFolde rs)
If not objFSO.FolderEx ists(arrFolders (i)) Then
objFSO.CreateFo lder(arrFolders (i))
End if
next

'We create missing files
If NOT objFSO.FileExis ts(SUB_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \default.asp", 1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(SUB_PATH , True)
Call objFile.Write(s Text)
Set objFile = nothing
End If

If NOT objFSO.FileExis ts(OTHERL_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \user.asp",
1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(OTHERL_P ATH, True)
Call objFile.Write(s Text)
Set objFile = nothing
End If
Set objFSO = nothing

if err<>0 then
err.Clear
Response.Write "<font face=arial><b>W arning :</b> To complete
installation of this SubDomain, you must give write permission to the
database and media directories (under IIS console, and explorer if you
use
NTFS).</font>"
Response.End
end if

End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JScri pt" RUNAT="Server">

//=============== =============== =============== =====
// call the vbscrip function with an error trapping
//=============== =============== =============== =====
function JSCheckAllFiles ()
{
try
{
CheckAllFiles() ;
}
catch(e) {
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must give write permission to the database and media
directories (under IIS console, and explorer if you use
NTFS).</font><br>");
return false;
}
}

//=============== =============== =============== =====
// Save an SUB file with FSO
//=============== =============== =============== =====
function SavesubFile(sFi leName, sContent)
{
var objFSO, objFile;

try
{
objFSO = new ActiveXObject(" Scripting.FileS ystemObject");
objFile = objFSO.CreateTe xtFile(sFileNam e, true, true);

}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must install VBScript runtime version
5.6.</font><br>");
return false;
}
try
{
objFile.Write(s Content);
objFile.close() ;
}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> Can't save xml file.
Check the write permission.</font><br>");
//objFile = objFSO.CreateTe xtFile(sFileNam e + "." + GetGuid(6), true,
true);
//objFile.Write(s Content);
//objFile.close() ;
return false;
}

//Response.Write( sFileName + " is updated.<br/>");
}

</SCRIPT>

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
>
> Paw wrote:
>> Greetings.
>> I use asp.
>> what I need is is when a visitor comes to the site, I need it to check
>> the host name. if "www.hometowndi gest.com" is the host, then check a
>> folder named "something" and if the folder does not exsist, create
>> folder "www" and then copy folder "temp" and its contents.
>>
>> If the folder "www" is there, look in it, check to see if the files in
>> folder "temp" are in there, if not, copy the files that are not from
>> folder "temp" into folder "www".
>>
>>
>> If instead of www.hometowndigest.com, it is
>> "vbscript.homet owndigest.com", I need it to do the same rountine. What
>> ever the subdomain name.
>>
>>
>> This file will be be drawn as an include file.
>>
>>
>> NOTE:
>>
>>
>> 1. I do not need it to look in folder "Temp/www" or folder
>> "temp/vbscript", etc, only folder "temp"
>> 2. Please note further includes along the way in the file will run
>> script. So, if it could not interfer with those by some kind of
>> statement.
>> 3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
>> do nothing.
>> 4. If the script cannot or would be too consuming of time or
>> resources,
>>
>> maybe i can manually add a listing of the files to look for in the
>> script through
>>
>>
>> Thanks in advance.
>> Paw.
>
> So what is your question? Which bit are you having difficulty with?
>
> --
> Mike Brind
>

May 30 '06 #6
What is the server 500 message and which line does it refer to?

--
Mike Brind

Paw wrote:
1. How do you define "not work"?

I get server 500 error message., files are not being written.

2. Where have you put your response.write statements to check that the
values you expect are actually there?

The code in the last post is the code I have. If not there, I didn't. I
know the folders and files are there with correct permissions.

3. Where are they failing?

Not sure.

4. What error messages do you get, if any?
Don't have access to my server logs.

I did see one typo in the code, I fixed it. Is it ok to attach a txt file to
the post of the code?

Thank you, Paul Chambers

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
1. How do you define "not work"?
2. Where have you put your response.write statements to check that the
values you expect are actually there?
3. Where are they failing?
4. What error messages do you get, if any?

--
Mike Brind
Paw wrote:
Thank You for your response.
here is the code I have so far. Not working though. Paul Chambers

<%

'+--------------------------------------------------------------+
'| FOLDERS |
'+--------------------------------------------------------------+

DIM ROOT_PATH : ROOT_PATH = server.MapPath( ".")
Dim LOCAL_FOLDER : = Root_path & "\local"

LOCAL_FOLDER = LOCAL_FOLDER & "\" &
mid(Request.Ser verVariables("S ERVER_NAME"),1 ,instr(1,
Request.ServerV ariables("SERVE R_NAME"), ".")-1)
'+--------------------------------------------------------------+
'| LOCAL CREATED FILES PATH |
'+--------------------------------------------------------------+
DIM SUB_PATH : SUBL_PATH = ROOT_PATH & LOCAL_PATH & "\default.a sp"
DIM OTHERL_PATH : OTHERL_PATH = ROOT_PATH & LOCAL_FOLDER & "\user.asp"


%>

<SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">

'============== =============== ===========
'---- Checks if the Sub files exist ----
'============== =============== ===========
' if not copy from the default one
'============== =============== ===========
'transform that as jscript
Sub CheckAllFiles()
Dim sText
Dim objFSO : Set objFSO =
server.CreateOb ject("scripting .Filesystemobje ct")
Dim objFile
Dim arrFolders
Dim arrFiles
Dim i

'We create missing folders
arrFolders = array(LOCAL_FOL DER)
for i=0 to uBound(arrFolde rs)
If not objFSO.FolderEx ists(arrFolders (i)) Then
objFSO.CreateFo lder(arrFolders (i))
End if
next

'We create missing files
If NOT objFSO.FileExis ts(SUB_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \default.asp", 1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(SUB_PATH , True)
Call objFile.Write(s Text)
Set objFile = nothing
End If

If NOT objFSO.FileExis ts(OTHERL_PATH) Then
Set objFile = objFSO.OpenText File(ROOT_PATH &
"\secure\master \user.asp",
1)
sText = objFile.ReadAll
Set objFile = nothing

Set objFile = objFSO.CreateTe xtFile(OTHERL_P ATH, True)
Call objFile.Write(s Text)
Set objFile = nothing
End If
Set objFSO = nothing

if err<>0 then
err.Clear
Response.Write "<font face=arial><b>W arning :</b> To complete
installation of this SubDomain, you must give write permission to the
database and media directories (under IIS console, and explorer if you
use
NTFS).</font>"
Response.End
end if

End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JScri pt" RUNAT="Server">

//=============== =============== =============== =====
// call the vbscrip function with an error trapping
//=============== =============== =============== =====
function JSCheckAllFiles ()
{
try
{
CheckAllFiles() ;
}
catch(e) {
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must give write permission to the database and media
directories (under IIS console, and explorer if you use
NTFS).</font><br>");
return false;
}
}

//=============== =============== =============== =====
// Save an SUB file with FSO
//=============== =============== =============== =====
function SavesubFile(sFi leName, sContent)
{
var objFSO, objFile;

try
{
objFSO = new ActiveXObject(" Scripting.FileS ystemObject");
objFile = objFSO.CreateTe xtFile(sFileNam e, true, true);

}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> To complete
installation, you must install VBScript runtime version
5.6.</font><br>");
return false;
}
try
{
objFile.Write(s Content);
objFile.close() ;
}
catch(e) {
Response.Append ToLog("SavesubF ile " + e);
Response.Write( "<font face=arial><b>W arning :</b> Can't save xml file.
Check the write permission.</font><br>");
//objFile = objFSO.CreateTe xtFile(sFileNam e + "." + GetGuid(6), true,
true);
//objFile.Write(s Content);
//objFile.close() ;
return false;
}

//Response.Write( sFileName + " is updated.<br/>");
}

</SCRIPT>

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
>
> Paw wrote:
>> Greetings.
>> I use asp.
>> what I need is is when a visitor comes to the site, I need it to check
>> the host name. if "www.hometowndi gest.com" is the host, then check a
>> folder named "something" and if the folder does not exsist, create
>> folder "www" and then copy folder "temp" and its contents.
>>
>> If the folder "www" is there, look in it, check to see if the files in
>> folder "temp" are in there, if not, copy the files that are not from
>> folder "temp" into folder "www".
>>
>>
>> If instead of www.hometowndigest.com, it is
>> "vbscript.homet owndigest.com", I need it to do the same rountine. What
>> ever the subdomain name.
>>
>>
>> This file will be be drawn as an include file.
>>
>>
>> NOTE:
>>
>>
>> 1. I do not need it to look in folder "Temp/www" or folder
>> "temp/vbscript", etc, only folder "temp"
>> 2. Please note further includes along the way in the file will run
>> script. So, if it could not interfer with those by some kind of
>> statement.
>> 3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
>> do nothing.
>> 4. If the script cannot or would be too consuming of time or
>> resources,
>>
>> maybe i can manually add a listing of the files to look for in the
>> script through
>>
>>
>> Thanks in advance.
>> Paw.
>
> So what is your question? Which bit are you having difficulty with?
>
> --
> Mike Brind
>


May 31 '06 #7
Paw
Thanks for you help, Mike. The last post you sent made me think to stop and
start over, which I did. I came up with some code that will work.

I have inserted it below.

Basically, for any whose interested, I give am getting ready to give away
blogging sites, with upgradable features for a small cost. I needed away to
setup up the new users without cost or labor by our team, except for after
setup tech supports and upgrades. My team as well as myself are all
disabled, web enabled. So lower costs are important. We are wildcarding
several domains to widen our reach. Tn-ol.com, hometowndigest. com,
thatinternetpla ce.com.

I have a package of asp scipts for the new users. Just needed a scalable
deployment system.

So to close, I just needed to create new folders based on subdomain, and
then copy a template folder. This is generic. I will implement it into my
secure pages until I start from scratch.

Below is the code.

I haven't done coding in years, and forgot alot. But its coming back to me.
If you could guide me in one more way, I would appreciate it. It probably is
novice but I can't seem to remember it all yet.

I would like to run more script from the setup page. what would the script
setup be for doing the next routine after this one. In the code below,
instead of "bye", "I would like to say and "now I am doing something else,
hold on " run the next script and so on until the final.

Have a good day..
Paul Chambers

'start code-----

Hello. I am creating client folders <br>
please Stand By while I create your folders and files.<br><img
src=status.gif> <br>

<%
dim fs,fo
SUBDONO=""
SUBDOYES=mid(Re quest.ServerVar iables("SERVER_ NAME"),1 ,instr(1,
Request.ServerV ariables("SERVE R_NAME"), ".")-1)

if inStr (SUBDOYES,SUBDO NO)=1 then
set fs=Server.Creat eObject("Script ing.FileSystemO bject")
set fo=fs.GetFolder ("put path to template folder in the form of
E:\something\te mplate")
fo.Copy("D:\som ething\client\f iles\" & SUBDOYES)
set fo=nothing
set fs=nothing
else
end if
%>
ok, I am done. Bye.
'end code

"Paw" <ha******@comca st.net> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
Greetings.
I use asp.
what I need is is when a visitor comes to the site, I need it to check
the host name. if "www.hometowndi gest.com" is the host, then check a
folder named "something" and if the folder does not exsist, create
folder "www" and then copy folder "temp" and its contents.

If the folder "www" is there, look in it, check to see if the files in
folder "temp" are in there, if not, copy the files that are not from
folder "temp" into folder "www".
If instead of www.hometowndigest.com, it is
"vbscript.homet owndigest.com", I need it to do the same rountine. What
ever the subdomain name.
This file will be be drawn as an include file.
NOTE:
1. I do not need it to look in folder "Temp/www" or folder
"temp/vbscript", etc, only folder "temp"
2. Please note further includes along the way in the file will run
script. So, if it could not interfer with those by some kind of
statement.
3. if the host is "hometowndigest .com", or "tn-ol.com", etc, anything,
do nothing.
4. If the script cannot or would be too consuming of time or resources,

maybe i can manually add a listing of the files to look for in the
script through
Thanks in advance.
Paw.

May 31 '06 #8
Paw
It didnt say. I was on IE 7 beta. I sent the last message before this one.
sorry..
"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
What is the server 500 message and which line does it refer to?

--
Mike Brind

Paw wrote:
1. How do you define "not work"?

I get server 500 error message., files are not being written.

2. Where have you put your response.write statements to check that the
values you expect are actually there?

The code in the last post is the code I have. If not there, I didn't. I
know the folders and files are there with correct permissions.

3. Where are they failing?

Not sure.

4. What error messages do you get, if any?
Don't have access to my server logs.

I did see one typo in the code, I fixed it. Is it ok to attach a txt file
to
the post of the code?

Thank you, Paul Chambers

"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
> 1. How do you define "not work"?
> 2. Where have you put your response.write statements to check that the
> values you expect are actually there?
> 3. Where are they failing?
> 4. What error messages do you get, if any?
>
> --
> Mike Brind
>
>
> Paw wrote:
>> Thank You for your response.
>> here is the code I have so far. Not working though. Paul Chambers
>>
>> <%
>>
>> '+--------------------------------------------------------------+
>> '| FOLDERS |
>> '+--------------------------------------------------------------+
>>
>> DIM ROOT_PATH : ROOT_PATH = server.MapPath( ".")
>> Dim LOCAL_FOLDER : = Root_path & "\local"
>>
>> LOCAL_FOLDER = LOCAL_FOLDER & "\" &
>> mid(Request.Ser verVariables("S ERVER_NAME"),1 ,instr(1,
>> Request.ServerV ariables("SERVE R_NAME"), ".")-1)
>>
>>
>> '+--------------------------------------------------------------+
>> '| LOCAL CREATED FILES PATH |
>> '+--------------------------------------------------------------+
>> DIM SUB_PATH : SUBL_PATH = ROOT_PATH & LOCAL_PATH & "\default.a sp"
>> DIM OTHERL_PATH : OTHERL_PATH = ROOT_PATH & LOCAL_FOLDER &
>> "\user.asp"
>>
>>
>>
>>
>> %>
>>
>> <SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">
>>
>>
>>
>> '============== =============== ===========
>> '---- Checks if the Sub files exist ----
>> '============== =============== ===========
>> ' if not copy from the default one
>> '============== =============== ===========
>> 'transform that as jscript
>> Sub CheckAllFiles()
>> Dim sText
>> Dim objFSO : Set objFSO =
>> server.CreateOb ject("scripting .Filesystemobje ct")
>> Dim objFile
>> Dim arrFolders
>> Dim arrFiles
>> Dim i
>>
>> 'We create missing folders
>> arrFolders = array(LOCAL_FOL DER)
>> for i=0 to uBound(arrFolde rs)
>> If not objFSO.FolderEx ists(arrFolders (i)) Then
>> objFSO.CreateFo lder(arrFolders (i))
>> End if
>> next
>>
>> 'We create missing files
>> If NOT objFSO.FileExis ts(SUB_PATH) Then
>> Set objFile = objFSO.OpenText File(ROOT_PATH &
>> "\secure\master \default.asp", 1)
>> sText = objFile.ReadAll
>> Set objFile = nothing
>>
>> Set objFile = objFSO.CreateTe xtFile(SUB_PATH , True)
>> Call objFile.Write(s Text)
>> Set objFile = nothing
>> End If
>>
>> If NOT objFSO.FileExis ts(OTHERL_PATH) Then
>> Set objFile = objFSO.OpenText File(ROOT_PATH &
>> "\secure\master \user.asp",
>> 1)
>> sText = objFile.ReadAll
>> Set objFile = nothing
>>
>> Set objFile = objFSO.CreateTe xtFile(OTHERL_P ATH, True)
>> Call objFile.Write(s Text)
>> Set objFile = nothing
>> End If
>>
>>
>> Set objFSO = nothing
>>
>> if err<>0 then
>> err.Clear
>> Response.Write "<font face=arial><b>W arning :</b> To complete
>> installation of this SubDomain, you must give write permission to the
>> database and media directories (under IIS console, and explorer if you
>> use
>> NTFS).</font>"
>> Response.End
>> end if
>>
>> End Sub
>>
>>
>> </SCRIPT>
>>
>>
>>
>> <SCRIPT LANGUAGE="JScri pt" RUNAT="Server">
>>
>> //=============== =============== =============== =====
>> // call the vbscrip function with an error trapping
>> //=============== =============== =============== =====
>> function JSCheckAllFiles ()
>> {
>> try
>> {
>> CheckAllFiles() ;
>> }
>> catch(e) {
>> Response.Write( "<font face=arial><b>W arning :</b> To complete
>> installation, you must give write permission to the database and media
>> directories (under IIS console, and explorer if you use
>> NTFS).</font><br>");
>> return false;
>> }
>> }
>>
>> //=============== =============== =============== =====
>> // Save an SUB file with FSO
>> //=============== =============== =============== =====
>> function SavesubFile(sFi leName, sContent)
>> {
>> var objFSO, objFile;
>>
>> try
>> {
>> objFSO = new ActiveXObject(" Scripting.FileS ystemObject");
>> objFile = objFSO.CreateTe xtFile(sFileNam e, true, true);
>>
>> }
>> catch(e) {
>> Response.Append ToLog("SavesubF ile " + e);
>> Response.Write( "<font face=arial><b>W arning :</b> To complete
>> installation, you must install VBScript runtime version
>> 5.6.</font><br>");
>> return false;
>> }
>>
>>
>> try
>> {
>> objFile.Write(s Content);
>> objFile.close() ;
>> }
>> catch(e) {
>> Response.Append ToLog("SavesubF ile " + e);
>> Response.Write( "<font face=arial><b>W arning :</b> Can't save xml
>> file.
>> Check the write permission.</font><br>");
>> //objFile = objFSO.CreateTe xtFile(sFileNam e + "." + GetGuid(6),
>> true,
>> true);
>> //objFile.Write(s Content);
>> //objFile.close() ;
>> return false;
>> }
>>
>> //Response.Write( sFileName + " is updated.<br/>");
>> }
>>
>> </SCRIPT>
>>
>>
>>
>>
>>
>> "Mike Brind" <pa*******@hotm ail.com> wrote in message
>> news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
>> >
>> > Paw wrote:
>> >> Greetings.
>> >> I use asp.
>> >> what I need is is when a visitor comes to the site, I need it to
>> >> check
>> >> the host name. if "www.hometowndi gest.com" is the host, then check
>> >> a
>> >> folder named "something" and if the folder does not exsist, create
>> >> folder "www" and then copy folder "temp" and its contents.
>> >>
>> >> If the folder "www" is there, look in it, check to see if the files
>> >> in
>> >> folder "temp" are in there, if not, copy the files that are not
>> >> from
>> >> folder "temp" into folder "www".
>> >>
>> >>
>> >> If instead of www.hometowndigest.com, it is
>> >> "vbscript.homet owndigest.com", I need it to do the same rountine.
>> >> What
>> >> ever the subdomain name.
>> >>
>> >>
>> >> This file will be be drawn as an include file.
>> >>
>> >>
>> >> NOTE:
>> >>
>> >>
>> >> 1. I do not need it to look in folder "Temp/www" or folder
>> >> "temp/vbscript", etc, only folder "temp"
>> >> 2. Please note further includes along the way in the file will run
>> >> script. So, if it could not interfer with those by some kind of
>> >> statement.
>> >> 3. if the host is "hometowndigest .com", or "tn-ol.com", etc,
>> >> anything,
>> >> do nothing.
>> >> 4. If the script cannot or would be too consuming of time or
>> >> resources,
>> >>
>> >> maybe i can manually add a listing of the files to look for in the
>> >> script through
>> >>
>> >>
>> >> Thanks in advance.
>> >> Paw.
>> >
>> > So what is your question? Which bit are you having difficulty with?
>> >
>> > --
>> > Mike Brind
>> >
>

May 31 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4442
by: Mario T. Lanza | last post by:
I am working with Visual Studio. The solution I am developing is composed of about 8 separate projects. Some of these projects represent different tiers in the N-tiered architecture (data, business logic, presentation, etc.). Right now, some of the projects are inter-related and reference each other using Project References. When I select...
1
3326
by: Antonio Lopez Arredondo | last post by:
hi all !!! I need to copy a folder and its subfolders to another location; which class should I use ? could only find the System.IO.Directory.MOVE but don't know how to COPY. thanks in advance, ant
3
309
by: nate | last post by:
I created a performance evaluation for our employees on our web server in a folder called 'performanceEval'. Now I wanted to create a slightly modified version for supervisors. I made a new folder on the server called 'supervisorEval' and copied the files from 'performanceEval' to over. Everytime I try to open the project in the...
2
2579
by: tatemononai | last post by:
Ok, this is a very unique bug. I have only been able to find one other post related to this online, and everybody who responded misunderstood the problem. I am not trying to reference anything in the BIN folder directly. Here is the problem. I had a site running without any problems, and then all of a sudden it went down and visitors...
17
3121
by: rdemyan via AccessMonster.com | last post by:
With A2003, I'm having trouble accessing files in a folder on another computer where back-end files, update files, etc are located. Here's the scenario: 1) Computer #1 - A2003 2) Computer #2 - Access 2000; folder with back-ends for both computers and 'Update' folder. I have a launcher program that launces my application (MyApp). The...
1
1904
by: halcyon943 | last post by:
have 4 folders that I watch and need to move files from to another location. Three constraints: -Finish time. Make sure the program stops transferring files at a specific time -Number of files transferred. Can only move a certain amount of files per time period. -Folders have a priority. The files have to be moved based on the folder...
4
2434
by: supriyamk | last post by:
Hi, I am trying to search a directory for subdirectories, recreate the subdirectories elsewhere and copy only certain files from current subdirectory to new subdirectory. In other words i am sorting filetypes into subdirectories with same name. so far i have been able to create the subdirectories, but i am not able to copy the files into...
2
1774
by: swethak | last post by:
hi, i want to copy the contents of one folder into another folder.For that i create the one new folder . I copied the files of already existing folder into new folder.For that i write a code as <?php mkdir("filesscreate",0777); copy('admin','filescreate'); ?>
9
2906
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading the text files from the watched folder line by line into variables and then posting them to a SQL table. All of the code for the form is shown...
0
7581
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7782
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7541
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5423
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5142
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2006
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1114
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.