def rsync(src_uri, dst_uri, exclude_dirs=[], port=22, dryrun=False):
    r"""
    Wrapper for rsync

    General function to push or pull a directory from a remote server to a
    local path

    Args:
        src_uri (str):
        dst_uri (str):
        exclude_dirs (list): (default = [])
        port (int): (default = 22)
        dryrun (bool): (default = False)

    References:
        http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

    CommandLine:
        python -m utool.util_grabdata rsync

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_grabdata import *  # NOQA
        >>> import utool as ut
        >>> src_uri = 'local/path/file.txt'
        >>> dst_uri = 'host.cs.college.edge:/remove/path/file.txt'
        >>> exclude_dirs = []
        >>> port = 22
        >>> dryrun = False
        >>> result = rsync(src_uri, dst_uri, exclude_dirs, port, dryrun)
        >>> print(result)

    Notes (rsync commandline options):
        rsync [OPTION]... SRC [SRC]... DEST
        -v : verbose
        -r : copies data recursively (but dont preserve timestamps and
                permission while transferring data
        -a : archive mode, allows recursive copying and preserves symlinks,
                permissions, user and group ownerships, and timestamps
        -z : compress file data
        -i, --itemize-changes       output a change-summary for all updates
        -s, --protect-args :        no space-splitting; only wildcard special-chars
        -h : human-readable, output numbers in a human-readable format
        -P                          same as --partial --progress
    """
    from utool import util_cplat
    rsync_exe = 'rsync'
    rsync_options = '-avhzP'
    #rsync_options += ' --port=%d' % (port,)
    rsync_options += ' -e "ssh -p %d"' % (port,)
    if len(exclude_dirs) > 0:
        exclude_tup = ['--exclude ' + dir_ for dir_ in exclude_dirs]
        exclude_opts = ' '.join(exclude_tup)
        rsync_options += ' ' + exclude_opts

    cmdtuple = (rsync_exe, rsync_options, src_uri, dst_uri)
    cmdstr = ' '.join(cmdtuple)
    print('[rsync] src_uri = %r ' % (src_uri,))
    print('[rsync] dst_uri = %r ' % (dst_uri,))
    print('[rsync] cmdstr = %r' % cmdstr)
    print(cmdstr)

    #if not dryrun:
    util_cplat.cmd(cmdstr, dryrun=dryrun)
def rsync ( src_uri , dst_uri , exclude_dirs = [ ] , port = 22 , dryrun = False ) : from utool import util_cplat rsync_exe = 'rsync' rsync_options = '-avhzP' rsync_options += ' -e "ssh -p %d"' % ( port , ) if len ( exclude_dirs ) > 0 : exclude_tup = [ '--exclude ' + dir_ for dir_ in exclude_dirs ] exclude_opts = ' ' . join ( exclude_tup ) rsync_options += ' ' + exclude_opts cmdtuple = ( rsync_exe , rsync_options , src_uri , dst_uri ) cmdstr = ' ' . join ( cmdtuple ) print ( '[rsync] src_uri = %r ' % ( src_uri , ) ) print ( '[rsync] dst_uri = %r ' % ( dst_uri , ) ) print ( '[rsync] cmdstr = %r' % cmdstr ) print ( cmdstr ) util_cplat . cmd ( cmdstr , dryrun = dryrun )
r"""
    Wrapper for rsync

    General function to push or pull a directory from a remote server to a
    local path

    Args:
        src_uri (str):
        dst_uri (str):
        exclude_dirs (list): (default = [])
        port (int): (default = 22)
        dryrun (bool): (default = False)

    References:
        http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

    CommandLine:
        python -m utool.util_grabdata rsync

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_grabdata import *  # NOQA
        >>> import utool as ut
        >>> src_uri = 'local/path/file.txt'
        >>> dst_uri = 'host.cs.college.edge:/remove/path/file.txt'
        >>> exclude_dirs = []
        >>> port = 22
        >>> dryrun = False
        >>> result = rsync(src_uri, dst_uri, exclude_dirs, port, dryrun)
        >>> print(result)

    Notes (rsync commandline options):
        rsync [OPTION]... SRC [SRC]... DEST
        -v : verbose
        -r : copies data recursively (but dont preserve timestamps and
                permission while transferring data
        -a : archive mode, allows recursive copying and preserves symlinks,
                permissions, user and group ownerships, and timestamps
        -z : compress file data
        -i, --itemize-changes       output a change-summary for all updates
        -s, --protect-args :        no space-splitting; only wildcard special-chars
        -h : human-readable, output numbers in a human-readable format
        -P                          same as --partial --progress