Discussion:
Deployment to multiple folders with Robocopy
(too old to reply)
masterslave
2009-07-09 00:34:12 UTC
Permalink
I need to deploy an ASP.NET application to multiple folders in IIS,
the application is a template with different parameters for each site
set in web.config. I'm trying to create a script with Robocopy that
would look at all directories in IIS and if a directory meets certain
criteria (has a specific file in it to make sure that this is the
required application folder) then copy files into it overwriting all
the contents.

I can't really work out how to do it in Robocopy that does look like a
good tool though so any advice much appreciated!
Pegasus [MVP]
2009-07-09 07:18:15 UTC
Permalink
Post by masterslave
I need to deploy an ASP.NET application to multiple folders in IIS,
the application is a template with different parameters for each site
set in web.config. I'm trying to create a script with Robocopy that
would look at all directories in IIS and if a directory meets certain
criteria (has a specific file in it to make sure that this is the
required application folder) then copy files into it overwriting all
the contents.
I can't really work out how to do it in Robocopy that does look like a
good tool though so any advice much appreciated!
You need to wrap robocopy into a batch file that looks into the various
folders. If you post specific details about folder names, file names and
your criteria then someone will suggest a suitable solution.
Mark D. MacLachlan
2009-07-09 08:23:58 UTC
Permalink
Post by masterslave
I need to deploy an ASP.NET application to multiple folders in IIS,
the application is a template with different parameters for each site
set in web.config. I'm trying to create a script with Robocopy that
would look at all directories in IIS and if a directory meets certain
criteria (has a specific file in it to make sure that this is the
required application folder) then copy files into it overwriting all
the contents.
I can't really work out how to do it in Robocopy that does look like a
good tool though so any advice much appreciated!
Need more details. Are you looking to have a script that is part of a
web page or that will run as a scheduled task?

Basics of what you are looking for are simple. Something like this:

[code]
Dim objFSO, WshShell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("wscript.Shell")

Set objFolder = objFSO.GetFolder("C:\InetPub\WWWRoot")

For Each sFolder In objFolder.SubFolders
If objFSO.FileExists(sFolder.Path & "\TestFile.txt") Then
WshShell.Run("CMD.EXE /C ROBOCOPY SourceDir " & sFolder.Path & "\
/MIR")
End If
Next
[/code]

Hope that helps,

Mark D. MacLachlan



--
masterslave
2009-07-09 23:37:22 UTC
Permalink
Thanks for the replies, guys! I would like to look at every folder
inside
C:\Inetpub\wwwroot and if a folder contains a file called
PriceComparison.aspx
then it is the folder I'm looking for and would like to overwrite it
with the contents
of the folder D:\Temp\OclCommerce. I'm looking for running the script
on
ad hoc basis, for updates - running a batch file would suit the
purpose perfectly!
Post by masterslave
I need to deploy an ASP.NET application to multiple folders in IIS,
the application is a template with different parameters for each site
set in web.config. I'm trying to create a script with Robocopy that
would look at all directories in IIS and if a directory meets certain
criteria (has a specific file in it to make sure that this is the
required application folder) then copy files into it overwriting all
the contents.
I can't really work out how to do it in Robocopy that does look like a
good tool though so any advice much appreciated!
Need more details.  Are you looking to have a script that is part of a
web page or that will run as a scheduled task?
[code]
Dim objFSO, WshShell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("wscript.Shell")
Set objFolder = objFSO.GetFolder("C:\InetPub\WWWRoot")
For Each sFolder In objFolder.SubFolders
        If objFSO.FileExists(sFolder.Path & "\TestFile.txt") Then
                WshShell.Run("CMD.EXE /C ROBOCOPY SourceDir " & sFolder.Path & "\
/MIR")
        End If
Next
[/code]
Hope that helps,
Mark D. MacLachlan
--
Mark D. MacLachlan
2009-07-10 15:22:30 UTC
Permalink
Post by masterslave
Thanks for the replies, guys! I would like to look at every folder
inside
C:\Inetpub\wwwroot and if a folder contains a file called
PriceComparison.aspx
then it is the folder I'm looking for and would like to overwrite it
with the contents
of the folder D:\Temp\OclCommerce. I'm looking for running the script
on
ad hoc basis, for updates - running a batch file would suit the
purpose perfectly!
OK, so the code I gave you earleir shoudl be just what you need. Here
it is modified with the details you just provided.


[code]
Dim objFSO, WshShell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("wscript.Shell")

Set objFolder = objFSO.GetFolder("C:\InetPub\WWWRoot")

For Each sFolder In objFolder.SubFolders
If objFSO.FileExists(sFolder.Path & "\PriceComparison.aspx") Then
WshShell.Run("CMD.EXE /C ROBOCOPY D:\Temp\OclCommerce " &
sFolder.Path & "\
/MIR")
End If
Next
[/code]


Hope that helps,

Mark D. MacLachlan
--
masterslave
2009-07-14 03:11:03 UTC
Permalink
Mark, thanks very much!!! That did it!!
Post by masterslave
Thanks for the replies, guys! I would like to look at every folder
inside
C:\Inetpub\wwwroot and if a folder contains a file called
PriceComparison.aspx
then it is the folder I'm looking for and would like to overwrite it
with the contents
of the folder D:\Temp\OclCommerce. I'm looking for running the script
on
ad hoc basis, for updates - running a batch file would suit the
purpose perfectly!
OK, so the code I gave you earleir shoudl be just what you need.  Here
it is modified with the details you just provided.
[code]
Dim objFSO, WshShell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("wscript.Shell")
Set objFolder = objFSO.GetFolder("C:\InetPub\WWWRoot")
For Each sFolder In objFolder.SubFolders
        If objFSO.FileExists(sFolder.Path & "\PriceComparison.aspx") Then
                WshShell.Run("CMD.EXE /C ROBOCOPY D:\Temp\OclCommerce " &
sFolder.Path & "\
/MIR")
        End If
Next
[/code]
Hope that helps,
Mark D. MacLachlan
--
Loading...