'Backup Files Before Copy' script option

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    'Backup Files Before Copy' script option

    Can this option be set in a script or can it only be saved in a session that you Load?

    I would like to incorporate it in a:

    sync create-empty mirror:lt->rt

    Is this possible?

    Thanks
  • Guest's Avatar

    #2
    Re: \'Backup Files Before Copy\' script option

    In other words .. My script is a follows:

    # Initialize
    log verbose "D:\My Documents\Data\Beyond Compare\SyncData-Fdisk.log"
    option confirm:yes-to-all

    #-----------------------------------------------------------
    # Sync My Documents
    #-----------------------------------------------------------
    load "Sync F-Disk"
    expand all
    sync create-empty update:lt->rt

    #----------------------------------------------------------
    # Delete orphaned files older than 60 days
    #----------------------------------------------------------
    select rt.orphan
    filter cutoff:>60days
    delete rt


    I'm keeping the orphans for 60 days, I would also like to keep a backup of a file prior to being replaced so that I can recover a file that was deleted or prior to being modified.

    Thanks

    Comment

    • Chris
      Team Scooter
      • Oct 2007
      • 5538

      #3
      Re: \'Backup Files Before Copy\' script option

      Right now the backup files setting is global for all sessions. You can turn it on or off in Tools|Options, but there isn't a way to set it per session or to set it in a script.

      Per session backup settings is on the wish list, and I'll add setting backup settings from scripts to the wish list.

      In your example script, you can mimic the behavior of the backup for copies by selecting rt.older.files and then copying them to a backup folder or renaming them before the sync.



      Chris K Scooter Software

      Comment

      • Guest's Avatar

        #4
        Re: \'Backup Files Before Copy\' script option

        Chris .. Thanks .. Your answer really surprised me .. I'd of thought that this great product would have had that capability already ;-)

        Comment

        • Guest's Avatar

          #5
          Re: \'Backup Files Before Copy\' script option

          Chris,

          If I select the older files on rt .. What regexp can I use so that I can use 'rename' and rename them to filename.bak

          Hint .. Rename examples in the Help file would be great ;-)

          Comment

          • Chris
            Team Scooter
            • Oct 2007
            • 5538

            #6
            Re: \'Backup Files Before Copy\' script option

            The easiest way to rename or append extensions is with a DOS rename.

            To append .bak using a DOS Rename ( file.txt -> file.txt.bak), you can use the script command:
            rename *.*.bak

            To replace the extension using a DOS Rename (file.txt -> file.bak), you can use:
            rename *.bak

            The regular expression rename in scripting has a bug right now so it doesn't work correctly. It will be fixed in our next release. Regular expression renames work fine in interactive sessions.

            Chris K Scooter Software

            Comment

            • Guest's Avatar

              #7
              Re: \'Backup Files Before Copy\' script option

              OK .. Thanks for the update .. looks like I need to wait .. Any timeframe when the next release (Beta is OK) will be out?

              Comment

              • Chris
                Team Scooter
                • Oct 2007
                • 5538

                #8
                Re: \'Backup Files Before Copy\' script option

                The next release with regular expressions in scripts fixed should be out some time this week.
                Chris K Scooter Software

                Comment

                • Guest's Avatar

                  #9
                  Re: \'Backup Files Before Copy\' script option

                  Chris,

                  To verify .. I downloaded 2.2.4 Build 222 and modified my script to:

                  select rt.older.files
                  rename *.*.bak
                  sync create-empty update:lt->rt

                  #-----------------------------------------
                  # Delete orphaned files older than 60 days
                  #-----------------------------------------
                  select rt.orphan
                  filter cutoff:>60days
                  delete rt

                  I believe that I must use 'Update' and not 'Mirror' on the Sync since the rename will make that file an orphan (.bak) which the sync mirror would then delete .. correct?

                  Thanks

                  Comment

                  • Chris
                    Team Scooter
                    • Oct 2007
                    • 5538

                    #10
                    Re: \'Backup Files Before Copy\' script option

                    That looks like it will work to backup older files.

                    Yes, the update sync is the one you want because mirror would delete your backups as orphans.
                    Chris K Scooter Software

                    Comment

                    • Guest's Avatar

                      #11
                      Re: \'Backup Files Before Copy\' script option

                      Chris,

                      Looks like my rename is failing ... Perhaps an option on 'rename' to erase the target first? Any other way to perform this?

                      7/26/2004 3:00:01 AM >> #-------------------------------------------------------------
                      7/26/2004 3:00:01 AM >> # Sync My Documents
                      7/26/2004 3:00:01 AM >> #-------------------------------------------------------------
                      7/26/2004 3:00:01 AM >> load "D:\My Documents" "F:\My Documents - Backup"
                      7/26/2004 3:00:01 AM Load Comparison: D:\My Documents <-> F:\My Documents - Backup
                      7/26/2004 3:00:01 AM >> expand all
                      7/26/2004 3:00:30 AM >> select rt.older.files
                      7/26/2004 3:00:30 AM >> rename *.*.bak
                      7/26/2004 3:00:30 AM Error renaming MRUFormsList: Target file already exists
                      7/26/2004 3:00:30 AM Error renaming OfflineDocs: Target file already exists
                      7/26/2004 3:00:30 AM Error renaming Reviews: Target file already exists
                      7/26/2004 3:00:30 AM Error renaming AutoFillDefaults.dat: Target file already exists
                      7/26/2004 3:00:30 AM Error renaming defaultHeuristics.dat: Target file already exists
                      7/26/2004 3:00:30 AM Error renaming udstore.js: Target file already exists

                      Comment

                      • Chris
                        Team Scooter
                        • Oct 2007
                        • 5538

                        #12
                        Re: \'Backup Files Before Copy\' script option

                        I will add an entry to the wish list to have an option for rename to overwrite existing files.

                        Instead of renaming the old files with a .bak extension, you can use the copyto command to copy them to a backup folder. The copyto command will allow you to overwrite older backups.

                        Make sure you use the option confirm:yes-to-all command to automatically confirm the warnings for over writing files.
                        Chris K Scooter Software

                        Comment

                        Working...