Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Deployment to multiple folders with Robocopy

Reply
Thread Tools Display Modes

Re: Deployment to multiple folders with Robocopy

 
 
Mark D. MacLachlan
Guest
Posts: n/a

 
      07-09-2009

masterslave wrote:

> 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
Hope that helps,

Mark D. MacLachlan



--

 
Reply With Quote
 
 
 
 
Mark D. MacLachlan
Guest
Posts: n/a

 
      07-10-2009

masterslave wrote:

> 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

Hope that helps,

Mark D. MacLachlan
--

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Deployment to multiple folders with Robocopy Pegasus [MVP] Scripting 0 07-09-2009 07:18 AM
Re: Copying folders with specific names (perhaps using ROBOCOPY) Pegasus \(MVP\) Windows Server 2 04-17-2009 10:31 PM
merge 100+ multiple folders into one! How? Robocopy? Xcopy? edwardtilbury Windows Vista File Management 0 10-27-2008 02:31 PM
robocopy how to preserve the files/folders previously copied study Scripting 2 03-11-2008 06:23 AM
Multiple site deployment. Marco Update Services 4 02-24-2006 07:56 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59