Announcement

Collapse
No announcement yet.

If drive X exists then mirror to drive X . Else mirror to drive Y.

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • If drive X exists then mirror to drive X . Else mirror to drive Y.

    This is my first post to this forum so I hope I’m in the right area and on topic.

    I have been trying to write a lazy script that will compare files then mirror from my main computer, look to see if the network drive is available on another computer. If so then mirror from the main computer to the first networked drive. If that drive is NOT found then continue on and mirror from the main drive to the last networked drive on the third computer.
    So the sequence is
    Mirror from main computer drive C: to main computer drive E
    The next lines would be to look to see if network drive X exits on the second computer . If it does then mirror files from drive C: to network drive X. If X does not exist then continue to the next lines and mirror files from main computer C: to network drive Y on the third computer.

    I can do this manually. I was writing the script to save some time and keystrokes.

  • #2
    Hello,

    BC4's script doesn't quite have this fall through logic. When certain errors are encountered, such as failing to load a base folder location, the script will fail with a fatal error. If you set up 3 separate scripts:
    C:\ to E,
    C to X,
    C to Y

    then each script could be called sequentially in an overall automated task, attempt the sync, and fail down to the next. However, if C to E succeeds, it would still then move to the next and attempt it as well. So if E and X don't fail, you could end up with 3 full copies.

    And just to make sure you are using the Sync Mirror logic you expect: please note that Mirror will delete all items in the Destination (E:\) that aren't in the Source (C:\). It will also overwrite any Newer, Older, or Different files in the Destination with whatever is in the Source. The only files a Mirror 'leaves alone' are already equal files, with the goal of making the Destination an exact copy of the Source.
    Sync Update will only copy over Newer files (overwrite Older files in the Destination) and won't delete any orphan files in the Destination. Please be sure to review the sync preview information in the interface to make sure the actions taken are the ones you need, as there is no *UNDO* after the action is committed.
    Similarly, script offers no Preview before acting, and also cannot Undo, so I suggest testing with Test locations first (C:\Temptest\ to E:\Temptest\) while learning and setting up the script. Just in case something isn't comparing as you expect, this would allow you to tweak the script before acting on your live data, which can overwrite or delete items.
    Aaron P Scooter Software

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎