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.

README.md 706 B

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940
  1. # grsync
  2. ```go
  3. package main
  4. import (
  5. "fmt"
  6. "grsync"
  7. "time"
  8. )
  9. func main() {
  10. task := grsync.NewTask(
  11. "username@server.com:/source/folder",
  12. "/home/user/destination",
  13. grsync.RsyncOptions{},
  14. )
  15. go func() {
  16. for {
  17. state := task.State()
  18. fmt.Printf(
  19. "progress: %.2f / rem. %d / tot. %d / sp. %s \n",
  20. state.Progress,
  21. state.Remain,
  22. state.Total,
  23. state.Speed,
  24. )
  25. time.Sleep(time.Second)
  26. }
  27. }()
  28. if err := task.Run(); err != nil {
  29. panic(err)
  30. }
  31. fmt.Println("well done")
  32. fmt.Println(task.Log())
  33. }
  34. ```