Skip to content

Commit

Permalink
Fix logging of transferred file count
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklasfrahm committed May 16, 2021
1 parent a62b44d commit ec1a983
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ func Copy(client *ssh.Client) {
}

log.Printf("%s %sing ...\n", emoji, strings.Title(direction))

transferredFiles := int64(0)
if len(sourceFiles) == 1 {
// Rename file if there is only one source file.
if _, err := copy(client, sourceFiles[0], targetFileOrFolder); err != nil {
Expand All @@ -167,6 +165,8 @@ func Copy(client *ssh.Client) {

log.Println("📡 Transferred 1 file")
} else {
transferredFiles := int64(0)

for _, sourceFile := range sourceFiles {
_, file := path.Split(sourceFile)
targetFile := path.Join(targetFileOrFolder, file)
Expand All @@ -178,7 +178,7 @@ func Copy(client *ssh.Client) {

transferredFiles += 1
}
}

log.Printf("📡 Transferred %d files\n", transferredFiles)
log.Printf("📡 Transferred %d files\n", transferredFiles)
}
}

0 comments on commit ec1a983

Please sign in to comment.