25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
梁 致源 528cbaa735 更新 'README.md' 2 년 전
.gitignore project init 4 년 전
README.md 更新 'README.md' 2 년 전
matcher.go project init 4 년 전
rsync.go project init 4 년 전
task.go project init 4 년 전

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())
}