Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Question 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.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,374

    Default

    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

  3. #3
    Join Date
    Jan 2013
    Posts
    2

    Default

    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"

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,584

    Default

    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 at 04:13 PM. Reason: Fixed line breaks
    Chris K Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •