continue process even failed to rename remote file

This commit is contained in:
r0n1n7an 2025-08-04 19:50:58 +08:00
parent e48ef455bd
commit a16eb3dc04
2 changed files with 4 additions and 3 deletions

Binary file not shown.

View File

@ -8,6 +8,7 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"gopkg.in/dutchcoders/goftp.v1" "gopkg.in/dutchcoders/goftp.v1"
@ -157,7 +158,7 @@ func _Upload(local, remote string) {
if suffix != "" { if suffix != "" {
err = os.Rename(local, local+suffix) err = os.Rename(local, local+suffix)
if err != nil { if err != nil {
log.Printf("[ERR] Rename Local File: %s -> %s; %s\r\n", local, local+suffix, err.Error()) log.Printf("[ERR] Rename Local File (Add Suffix): %s\r\n", strings.ToTitle(err.Error()))
return return
} }
} }
@ -185,11 +186,11 @@ func _Upload(local, remote string) {
err = ftp.Rename(remote+"/"+baseLocal+suffix, remote+"/"+baseLocal) err = ftp.Rename(remote+"/"+baseLocal+suffix, remote+"/"+baseLocal)
if err != nil { if err != nil {
log.Printf("[ERR] Rename Remote File: %s --> %s; %s\r\n", remote+"/"+baseLocal+suffix, remote+"/"+baseLocal, err.Error()) log.Printf("[ERR] Rename Remote File: %s --> %s; %s\r\n", remote+"/"+baseLocal+suffix, remote+"/"+baseLocal, err.Error())
return //return
} }
err = os.Rename(local+suffix, local) err = os.Rename(local+suffix, local)
if err != nil { if err != nil {
log.Printf("[ERR] Rename Local File: %s -> %s; %s\r\n", local+suffix, local, err.Error()) log.Printf("[ERR] Rename Local File (Remove Suffix): %s\r\n", strings.ToTitle(err.Error()))
return return
} }
} }