Skip to content

abu-usama/grsync

 
 

Repository files navigation

grsync — golang rsync wrapper

codecov GoDoc

Repository contains some helpful tools:

  • raw rsync wrapper
  • rsync task — wrapper which provide important information about rsync task: progress, remain items, total items and speed

Task wrapper usage

package main

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

func main() {
    task := grsync.NewTask(
        "[email protected]:/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.After(time.Second)
        }
    }()

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

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

About

Golang rsync wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.2%
  • Shell 0.8%