You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
You need to have an rsync installation on your system and added to your system's path.
Installation
download this repository
from within this repo runmake install
test installation by importingrsyncer in a python shell
Usage
You can choose between the simpleOne-Function-Call and the more powerfulSyncer utility to run rsync commands usingrsyncer.
TheOne-Function-Call
This is the simplest usage of rsyncer. You can just call thersync function with the necessary arguments to run arsync command. This function will return a boolean indicating if the process finished successfully or not:
fromrsyncer.rsyncimportrsyncsuc=rsync(...)ifsuc:print("rsync run successfully.")else:print("There was an error running rsync.")
The more powerfulSyncer object
With this utility, you get a larger set of functionalities like
creating a rsync command
running a rsync command
get the current progress of a running rsync process
...
Mark:rsyncer.rsync.Syncer creates a temporary files in/tmp where rsync's output is written to. Therefore, aSyncershould be closed when you are done working with it (The rsync subprocess will not be killed).
You can either create aSyncer object and use itsclose() (orexit(), which will kill the rsync process) method inthe end, or you can use aSyncer within awith statement:
fromrsyncerimportrsyncs=rsync.Syncer(...)s.run()s.get_command()s.progress()# and/or other operationss.close()# or s.exit() if you want to kill the rsync process as well
fromrsyncerimportrsyncwithrsync.Syncer(...)ass:s.run()s.get_command()s.progress()# and/or other operations
Examples
As far as possible, we provide aOne-Function-Call and aSyncer implementation for each example.