|
|||||||
| Register | FAQ | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
My plan is to update a web site and remove any extra files. I have a site in DEV and I want to move it to Prod. I have set up my script using a sample I found on your web site. # Keeping a web site in sync # This script keeps a web site in sync with development files. ###### # Turn verbose logging on. log verbose append:"C:\My Log.txt" # Set the comparison criteria. criteria binary size # Load source and target folders. # load "E:\DevSite\0000\" "E:\inetpub\0000\" # Filter to only include source files, ignore CVS subfolders. filter "*.htm;*.html;*.php;*.jpg;*.gif;-CVS\" # Sync the local files to the web site, creating empty folders. sync create-empty mirror:left->right option confirm:yes-to-all ####### I added the option confirm:yes-to-all as part of my trouble shooting. I need to be able set the Dev site and the Prod site on the fly. I run the script like this. $exe = "E:\Tools\Beyond Compare 3\BCompare.exe" & $exe -p $New $Old "@E:\Scripts\PS1\IISProject\SyncWebSite.txt" I am using Powershell so the $ are required. The script runs, but it just opens BC3 with the directories displayed and the the difference file highlighted. It does NOT sync the directories. Am i missing a step? |
|
#2
|
|||
|
|||
|
Hello,
The command line should be: Bcompare.exe "@E:\Scripts\PS1\IISProject\SyncWebSite.txt" "$P1" "$P2" I assume your $New and $Old variables are full paths you wish to reference in script? You can then reference them with %1 and %2 in the script.txt, but I do not see that in your sample script. Please be careful, if you are loading %1 and %2 as left and right, do not mix up the order or your sync mirror will replace the wrong folder. Script actions are not undo-able. I suggest using test data and already backed up folders for any script testing until you are comfortable with how script will function. Edit: You do not need the option to confirm yes to all unless you are seeing one of the few pop-up dialogs that can occur while running script. Yes to all, when present (usually as the first line of script) would essentially click Yes to any of these dialogs.
__________________
Aaron P Scooter Software Last edited by Aaron; 18-Jul-2012 at 10:28 AM. Reason: Edit |
|
#3
|
|||
|
|||
|
Thanks for the quick answer. Now i am getting an odd error:
Exception: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. And the sync still does not happen. |
|
#4
|
|||
|
|||
|
Hello,
Does this error occur if you try to perform the sync in the graphical interface? Can you narrow it down to a specific single file, or does any single file transfer cause it? If so, if you copy that same file using Windows Explorer, do you see a similar or different error?
__________________
Aaron P Scooter Software |
|
#5
|
|||
|
|||
|
Quote:
$exe = "E:\Tools\BEYOND~1\BCompare.exe" $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait " + $exe + " @E:\Scripts\PS1\IISProject\SyncWebSite.txt $left $right") I don't get the error anymore, but the sync does not happen. I can sync in the gui. The program flashes on the screen and then closes. |
|
#6
|
|||
|
|||
|
It was the filters that was causing the problem, at least with the not syncing. I also changed my SyncWebSite.txt to this and removed the filters:
# Keeping a web site in sync # This script keeps a web site in sync with development files. ###### # Turn verbose logging on. log verbose append:"C:\My Log.txt" # Set the comparison criteria. criteria binary size # Load source and target folders. load %1 %2 # Filter to only include source files, ignore CVS subfolders. # filter *.htm;*.html;*.php;*.jpg;*.gif;-CVS\ # Sync the local files to the web site, creating empty folders. sync create-empty mirror:left->right ####### Complete Powershell script: ########### Function Show-Inputbox { Param([string]$message=$(Throw "You must enter a prompt message"), [string]$title="Input", [string]$default ) [reflection.assembly]::loadwithpartialname("microsoft.visualbasic") | Out-Null [microsoft.visualbasic.interaction]::InputBox($message,$title,$default) } $Dev = Show-Inputbox -message "The Dev Web files location" ` -title "Path" -default "E:\DevSite\0000\" $Prod = Show-Inputbox -message "The Prod Web files location" ` -title "Path" -default "E:\inetpub\0000\" $left = $Dev $right = $Prod $exe = "E:\Tools\BEYOND~1\BCompare.exe" $p = [diagnostics.process]::Start("cmd.exe", "/c start /wait " + $exe + " @E:\Scripts\PS1\IISProject\SyncWebSite.txt $left $right") # all one line ############# Last edited by MFelkins; 18-Jul-2012 at 12:11 PM. |
|
#7
|
|||
|
|||
|
In the commented out section, the filter line does need "quotes" around the filter section if you intend to reuse this line later. If you load the two folders in the graphical interface, and then copy/paste your filter into the Filters textbox in the upper right corner (but without the "quotes"), do the items show or exclude as expected?
Edit: As a general tip, it is always best to get things working as expected in the graphical interface first. Then use script and call the script from the Windows Command line. Once that is working, then try to integrate into a larger script scenario.
__________________
Aaron P Scooter Software Last edited by Aaron; 18-Jul-2012 at 01:43 PM. Reason: Edit |
|
#8
|
|||
|
|||
|
Thanks for your help
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|