You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
梁 致源 528cbaa735 更新 'README.md' 4 months ago
.gitignore project init 1 year ago
README.md 更新 'README.md' 4 months ago
matcher.go project init 1 year ago
rsync.go project init 1 year ago
task.go project init 1 year ago

README.md

grsync

package main

import (
    "fmt"
    "grsync"
    "time"
)

func main() {
    task := grsync.NewTask(
        "username@server.com:/source/folder",
        "/home/user/destination",
        grsync.RsyncOptions{},
    )

    go func() {
        for {
            state := task.State()
            fmt.Printf(
                "progress: %.2f / rem. %d / tot. %d / sp. %s \n",
                state.Progress,
                state.Remain,
                state.Total,
                state.Speed,
            )
            time.Sleep(time.Second)
        }
    }()

    if err := task.Run(); err != nil {
        panic(err)
    }

    fmt.Println("well done")
    fmt.Println(task.Log())
}