The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Additional Sync Controls: Backup and Force

library(syncdr)

Synchronizing Using Additional Options

To retain more control over the synchronization process, you can utilize two additional options available for all synchronization functions: backup and force.

For example, suppose you are performing a full asymmetric synchronization of your, say, left and right directories. This type of synchronization entails that certain files will be copied over to the right directory, as well as that certain files will be deleted from it.

To maintain greater control over the process, you can allow the function to perform the synchronization while simultaneously storing a copy of the original directory before any changes occur. This way, you can revert to the original if needed.


# generate toy directories
e     <- toy_dirs()
#> ■■■■■■■■■                         27% | ETA:  9s
#> ■■■■■■■■■■■■■■■■■■■               60% | ETA:  6s

.syncdrenv.1 <- syncdr:::copy_temp_environment()

# Get left and right directories' paths 
left  <- .syncdrenv.1$left
right <- .syncdrenv.1$right

sync_status <- compare_directories(left, right)

# call sync function
full_asym_sync_to_right(sync_status = sync_status,
                        backup      = TRUE)
#> ✔ synchronized

Another option is to visualize a preliminary check, before the synchronization takes place. This can be done taking advantage of the force option. Note that prompt for user confirmation will work when you run the function interactively in your R session. However, this interactive prompt will not be functional within this article.


full_asym_sync_to_right(sync_status = sync_status,
                        force      = FALSE)
#> These files will be DELETED in right
#> 
#> |Files               |Action        |
#> |:-------------------|:-------------|
#> |/C/C1_duplicate.Rds |To be deleted |
#> |/D/D3.Rds           |To be deleted |
#> |/E/E1.Rds           |To be deleted |
#> |/E/E2.Rds           |To be deleted |
#> |/E/E3.Rds           |To be deleted |
#> These files will be COPIED (overwriting if present) to right 
#> 
#> 
#> |Files     |Action       |
#> |:---------|:------------|
#> |/D/D1.Rds |To be copied |
#> |/D/D2.Rds |To be copied |
#> |/A/A1.Rds |To be copied |
#> |/A/A2.Rds |To be copied |
#> |/A/A3.Rds |To be copied |
#> |/B/B3.Rds |To be copied |
#> Do you want to proceed? Type your answer (Yes/no/cancel) 
#> ✔ synchronized

#You will need to type `no` or 'cancel' to stop the synchronization

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.