Go一个脚本push To Aws S3
package main
import (
"fmt"
"os/exec"
)
func main(){
//for i := 0; i < 1502; i++ {
for i := 0; i < 3; i++ {
command := "aws s3 cp --acl public-read-write nft/parachain/" + fmt.Sprintf("%v", i) + " s3://nft-data.raindrop.link/nft/parastate/" + fmt.Sprintf("%v", i)
fmt.Println("== executing command: %s \n", command)
// 这里每个参数都要有个空格
// fmt.Sprintf("%v", 3) 就是把数字转换成String out, err := exec.Command("aws", "s3", "cp", "--acl", "public-read-write", "nft/parachain/" + fmt.Sprintf("%v", i), "s3://nft-data.raindrop.link/nft/parastate/" + fmt.Sprintf("%v", i)).Output() if err != nil { fmt.Printf(" ERROR: %s", err) }else{ fmt.Printf(" OK: %s", out) } } }
// fmt.Sprintf("%v", 3) 就是把数字转换成String out, err := exec.Command("aws", "s3", "cp", "--acl", "public-read-write", "nft/parachain/" + fmt.Sprintf("%v", i), "s3://nft-data.raindrop.link/nft/parastate/" + fmt.Sprintf("%v", i)).Output() if err != nil { fmt.Printf(" ERROR: %s", err) }else{ fmt.Printf(" OK: %s", out) } } }
This post is licensed under
CC BY 4.0
by the author.
Recently Updated