Announcement

Collapse
No announcement yet.

Compare and Sync 2 folders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compare and Sync 2 folders

    Hi there
    I'm testing something and i would like to get some suggestions/advice or help please

    I have 2 servers to test with. I have written a batch file which will sync server B with server A.

    There are 6 folders in each of the servers. At the minute we manually copy the 6 folders across from server B to server A. Since each of these folders are time consuming. I was wondering can use BC tool to compare and sync only those files that are mismatching between the 2 folders.

    Can we call BCtool to run on any server on which it is not installed. i.e. can i call BCtool installed on server X to run on server Y which doesn;t have BC tool installed?

  • #2
    Yes, you can do this with Beyond Compare. As long as the computer running BC can access the files on the servers as a network drive or through FTP, BC doesn't need to be installed on the servers.

    Here's an example file synchronization script that will copy new and updated files from server1 to server2:

    load \\server1\share \\server2\share
    sync update:lt->rt

    To run the above script, save it as a text file, then use the command "bcompare.exe @script.txt".
    Chris K Scooter Software

    Comment


    • #3
      Hi Chris

      Thanks for the reply. Is it possible to take the backup of those files in server A which are mismatches to server B before synchronising the files?

      Comment


      • #4
        Hello,

        You can use the Select scripting command to select your files (different, newer, older, orphan, etc), then use the Copy command to manually copy them.

        Note: the select different.files will select files that are timestamp equal, but different content(size)-wise. You will need to use the newer or older selections if you wish to copy files that are timestamp different.

        You can find detailed scripting documentation in the Help File under Scripting Reference.

        We can also help with your specific example. Is Server A = Server 1? Those are the files that were copying from Server1 to Server2, so would they need to be backed up? They would be in both locations after the copy. Or did you mean you wanted to back up the Server 2 (Destination) files before replacing them?
        Aaron P Scooter Software

        Comment


        • #5
          Hi Aaron
          Yes, server A = server 1 and server B = server 2 . server 1 is the destination i.e. a development machine and server 2 is the source i.e. a production machine.

          server 1 i.e. destination server has to be compared with server 2 i.e. source server. There are 3 big folders(including subfolders within it to compare) on both the source and the destination server. After comparing the 2 servers, the files which are mismatches i.e. only the files on the destination server i.e. server 1 has to be backedup to a folder and then same files must be copied across from source i.e. server 2 to the destination i.e. server 1.

          regards

          Comment


          • #6
            Hello,

            If server1 is the destination, then let us assume it is on the right side. If it is on the left, then you will need to reverse directions. Note: the Path parameter could be relative or base, depending on what kind of folder structure you would like to preserve.
            load \\server2\share \\server1\share
            expand all
            select right.older.files
            copyto path:base c:\\backupLocation\%date%\
            sync update:lt->rt

            Also, please test the above script with already backed up or test data, until you are more comfortable with how the script works.
            Last edited by Aaron; 29-Dec-2009, 11:06 AM. Reason: Use Test Data
            Aaron P Scooter Software

            Comment

            Working...
            X