Touch Script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bgreer5050
    Journeyman
    • Jul 2008
    • 16

    Touch Script

    Sometimes I have files that are exactly the same, but different time stamps only. If I touch all older files on the right to match the time stamp from the left:

    load "f:\" "e:\"
    expand all
    select left.newer
    touch lt->rt

    Will the files be considered the same now? My concern is that with a script, I will copy the time stamp and then Beyond Compare will consider the files the same, when there may be other contents within the file that differ.

    Please Advise. I need some reassurance.
  • Zoë
    Team Scooter
    • Oct 2007
    • 2666

    #2
    If you make the timestamps the same and the sizes are the same then yes, BC will now consider them the same. If you don't want that you'll need to do a content comparison.

    What, exactly, are you trying to do?
    Zoë P Scooter Software

    Comment

    • bgreer5050
      Journeyman
      • Jul 2008
      • 16

      #3
      I have two external drives. I keep turn one on for a week and then at the end of the week I like to synch and switch to the other drive. I notice that when I turn the other one on, all of the files have a different time stamp when a change has only been made to a few. My goal is to copy the time stamp from the files of one drive to the other, before copying differences and orphans from one drive to the other.

      Comment

      • Zoë
        Team Scooter
        • Oct 2007
        • 2666

        #4
        Are the timestamps changing for all of the files, or just more than what's had the actual content changed? If it's all files you should try fixing that issue; if your external drives are FAT32 you might consider reformatting them as NTFS. NTFS stores all timestamps in UTC and converts them to the local time when it loads them; FAT32 stores them as local times all the time. That's usually only an issue around the daylight saving transitions though.

        If it isn't every file, then you basically have two choices: (1) Re-copy every file with different timestamps, or (2) compare all files with different timestamps, update the timestamps, then copy the differences. (1) involves a single read pass from the source and a single write pass to the destination, while (2) does two read passes on the source, plus one read pass and one write pass to the destination. If writing is significantly slower than reading then (2) will be faster, but (1) may be faster since it doesn't have to read from the destination at all.

        (1) just involves using the sync's "mirror" or "update" commands.

        (2) Your script would look something like:

        load "f:\" "e:\"
        expand all
        select lt.newer.files
        compare binary
        touch lt->rt
        select lt.diff.files
        copy lt->rt

        The selection doesn't change after the "compare binary" line, so files that are the same now would still be selected. The touch would then update all of those, and any files that were actually different would still be classified as differences, but won't be newer anymore.
        Zoë P Scooter Software

        Comment

        • bgreer5050
          Journeyman
          • Jul 2008
          • 16

          #5
          "The selection doesn't change after the "compare binary" line, so files that are the same now would still be selected. The touch would then update all of those, and any files that were actually different would still be classified as differences, but won't be newer anymore.
          "

          The compare binary part of the script prevents differences from being replaced ?

          Thanks for the help. I love this software.

          Comment

          • Zoë
            Team Scooter
            • Oct 2007
            • 2666

            #6
            Make sure you test the script on some samplers before you use it on the full drives. What the compare binary bit does is keep files that just have different timestamps from getting copied but updating just their timestamps instead.
            Zoë P Scooter Software

            Comment

            Working...