Output Only Changes to a 3rd folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nikolawannabe
    New User
    • Jan 2013
    • 2

    Output Only Changes to a 3rd folder

    I'm attempting to write a script which compares two directories to each other and then outputs the differences between the two to a 3rd folder, with the path information retained. I have the following:

    Code:
    option confirm:yes-to-all
    load "pathtooldfolder" "pathtonewfolder"
    compare binary
    expand all
    select left.newer.files left.orphan.files path:base
    copyto left  path:base "pathtooutputfolder"
    This does not do what I want as it copies all files from the old folder to the output folder. Any help would be appreciated.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16000

    #2
    Hello,

    The small misstep here is the use of "compare binary". This command requires a selection first, so this script isn't actually running the binary compare and instead is using the default timestamp/size. Would all your files be newer on the left? This would cause the next couple of steps to copy them all.

    Instead of compare, use criteria, and place it above the load. By having the criteria defined before a load, the load command itself performs the compare. Otherwise, the load runs the default compare, then the compare command runs a second comparison.

    Code:
    option confirm:yes-to-all
    criteria binary
    load "pathtooldfolder" "pathtonewfolder"
    expand all
    select left.diff.files left.orphan.files
    copyto left path:base "pathtooutputfolder"
    How does this work for you?
    Aaron P Scooter Software

    Comment

    • nikolawannabe
      New User
      • Jan 2013
      • 2

      #3
      Thanks. This code works. If I use the log normal option in the script though, it does not seem to work correctly - it copies all the files. For now I have removed the log option.

      The option with problems:
      Code:
      log normal "pathtologfile\Synclog.txt"

      Comment

      • Chris
        Team Scooter
        • Oct 2007
        • 5538

        #4
        The log command shouldn't affect which files are copied.

        Aaron's example script with the log command added should look like this:

        log normal "pathtologfile\Synclog.txt"
        criteria binary
        option confirm:yes-to-all
        load "pathtooldfolder" "pathtonewfolder"
        expand all
        select left.diff.files left.orphan.files
        copyto left path:base "pathtooutputfolder"
        Last edited by Chris; 04-Jan-2013, 04:13 PM. Reason: Fixed line breaks
        Chris K Scooter Software

        Comment

        Working...