-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (33 loc) · 1.02 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"flag"
"log"
)
func main() {
protocol := flag.String("protocol", "", "Transfer protocol (azureblob, cifs, sftp, s3, local)")
source := flag.String("source", "", "Source file path")
destination := flag.String("destination", "", "Destination file path")
flag.Parse()
if *protocol == "" || *source == "" || *destination == "" {
log.Fatal("protocol, source, and destination are required")
}
// Initialize configuration
initConfig()
// Initialize database
db, err := initDatabase()
if err != nil {
log.Fatalf("Failed to initialize database: %v", err)
}
defer db.Close()
// Transfer file
err = transferFile(*protocol, *source, *destination)
if err != nil {
log.Fatalf("File transfer failed: %v", err)
}
// Log transfer
err = logTransfer(db, *protocol, *source, *destination)
if err != nil {
log.Printf("Failed to log transfer: %v", err)
}
log.Println("File transfer completed successfully")
}